upstream proxy support

Maxim Dounin mdounin at
Fri Mar 22 15:34:32 UTC 2013


On Fri, Mar 22, 2013 at 04:14:18PM +0100, Bernd Rössl wrote:

> hi,
> do you mean something like a new proxy directive like for example
> "proxy_server"?
> upstream squid {
>     server squid-host:3128;
> }
> upstream example {
>     server;
> }
> location = '/foo' {
>     proxy_server squid;
>     proxy_pass http://example/bar <>";
> }
> if "proxy_server" has been set this will be used as the actual upstream and
> the upstream from the proxy_pass will be used for request building.

Or something like proxy_uri, which would allow to redefine URI 
used in a request line.  This way it will be more consitent with 
fastcgi_pass and friends.  (It is not clear how this should be 
inherited though.)

Note though that overall we are not really intrested in teaching 
nginx to talk to forward proxies, and probably simpliest 
solution for a specific problem for now would be to abuse rewrite 
problems and force it to work like with your original patch.  
Something like this should work (note leading space):

    location / {
        rewrite ^ " http://foo/bar" break;
        proxy_pass http://squid;

It should do roughly the same as your original patch, but doesn't 
pretend this is correct and supported.

(Please don't post html here, use plain text.  Thank you.)

Maxim Dounin

More information about the nginx-devel mailing list