ProxyPass to target need to pass another proxy

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:

On Mon, Mar 23, 2015 at 09:09:07AM -0400, elronar wrote:

Hi there,

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

nginx as a client speaks http to a http server.

It does not speak http-being-proxied to a http proxy server.

Anyone another idea?

Assuming that I’ve correctly understood your setup:

Option 1 - do not use nginx as the client.

Option 2 - change your squid to listen for http, not just for
http-being-proxied.

(This may be called “transparent mode”. The squid documentation probably
has more.)

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

apache2 does speak http-being-proxied to a http proxy server.

f

Francis D. [email protected]