ProxyPass to target need to pass another proxy

elronar nginx-forum at nginx.us
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;
	server_name install.peng.puff.de;

	location ~
^/(mirror/ubuntu|debian-peng/ubuntu|ppa/libreoffice/ppa/ubuntu|ppa/natecarlson/maven3/ubuntu|ppa/ondrej/php5-5.6/ubuntu|mirror/apt.puppetlabs.com|VirtualBox/debian|ppa/webupd8team/java/ubuntu)(.*)$
{
		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            install.peng.puff.de; 
		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 172.31.2.35 TAG_NONE/400 3706 GET
/http://install.peng.puff.de/ppa/webupd8team/java/ubuntu/dists/trusty/main/source/Sources
- 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: http://forum.nginx.org/read.php?2,257562,257562#msg-257562



More information about the nginx mailing list