Hello! On Fri, Nov 18, 2016 at 02:55:13PM -0500, CJ Ess wrote:
> I know its not encouraged but I am trying to use Nginx (specifically > openresty/1.11.2.1 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 http://www.google.com/" as an example and found: > > This does work: > > location / { > resolver 127.0.0.1; > proxy_pass $scheme://www.google.com$request_uri$is_args$args; > } > > This does not: > > location / { > resolver 127.0.0.1; > 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 > delivered. > > Is there any unofficial advice? Unofficial advice is to try looking into error log, it is expected to contain details. In this particular configuration I see at least the following problems: - $http_host is used, but Host header won't be available in case of forward proxy; $host is to be used instead, it will also contain host from the request line. - $request_uri already includes request arguments, "$is_args$args" part is not needed. -- Maxim Dounin http://nginx.org/ _______________________________________________ nginx mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx
