Using NGINX as a forward proxy

CJ Ess zxcvbn4038 at
Fri Nov 18 19:55:13 UTC 2016

I know its not encouraged but I am trying to use Nginx (specifically
openresty/ which is based on Nginx 1.11.2) as a forward proxy.

I did a quick setup based on all the examples I found in Google and tried
"GET" as an example and found:

This does work:

  location / {
    proxy_pass $scheme://$request_uri$is_args$args;

This does not:

  location / {
    proxy_pass $scheme://$http_host$request_uri$is_args$args;

In the latter example it seems that using the $http_host variable is
causing the problem - there is a hang for a few seconds then a 502 error is

Is there any unofficial advice?

I also see this module:

And I really don't want to change nginx core and am concerned it'll stop
being developed after being merged with tengine, but it looks like a
possible solution - anyone have success with it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list