ProxyPass to target need to pass another proxy

elronar nginx-forum at
Mon Mar 23 13:09:07 UTC 2015

Hey guys,

I have the following plan. 

I need to configure an nginx via proxypass. The target of the proxy itself
is behind a proxy. 

My config looks like this:

upstream @squid {
	server XXX.YYY.FFF.EEE:3128;

server {
	listen 80;

	location ~
		proxy_pass 		http://@squid/$scheme://$host$uri;
		proxy_redirect 		off;
		proxy_set_header 	X-Forwarded-Proto $scheme;
        	proxy_set_header 	Request-URI $request_uri;
		proxy_set_header        Host  ; 
		proxy_set_header        X-Real-IP       $remote_addr;
		proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;


The squid and host entry are concatinated but the squid is not able to parse
it caused by the / between @squid/$scheme. So the squid tries to connect to
1426763671.035      0 TAG_NONE/400 3706 GET
- HIER_NONE/- text/html 

I also tried to delelte the slash but this try has been marked as invalid
config by nginx.

Anyone another idea?

In apache2 it is "only" a ProxyRemote * XXX.YYY.FFF.EEE:3128 .

Posted at Nginx Forum:,257562,257562#msg-257562

More information about the nginx mailing list