bugfix: ngx.req.set_header("Host", value) would overwrite the value of $host with bad values. thanks aviramc for the patch in #293 (and issue #292).