upstream proxy support

Bernd Rössl bernd.roessl at gmail.com
Fri Mar 22 15:14:18 UTC 2013


hi,

do you mean something like a new proxy directive like for example
"proxy_server"?

upstream squid {
    server squid-host:3128;
}
upstream example {
    server www.example.com:80;
}

location = '/foo' {
    proxy_server squid;
    proxy_pass http://example/bar <http://www.example.com/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.

bernd

2013/3/22 Maxim Dounin <mdounin at mdounin.ru>

> Hello!
>
> On Fri, Mar 22, 2013 at 03:12:23PM +0100, Bernd Rössl wrote:
>
> > hi,
> >
> > currently there is no way to rewrite to a url containing a schema and
> > proy_passing the request to a upstream since such a rewrite will end
> > up in a redirect. This is a problem if nginx is running behind a proxy
> > like squid which uses abolute url's to pass the request to. however,
> > absolute uri's are valid in requests and commonly used in proxies, for
> > details see
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2
> >
> > attached is a patch with a fix for ngx_http_rewrite_module.c which
> > introduces a new flag for the rewrite directive called "noredirect" to
> > allow redirect targets containing a schema
> >
> > in config this will look like this:
> >
> > location = '/foo' {
> >     rewrite  .*  "http://www.example.com/bar" noredirect;
> >     proxy_pass http://squid-host;
> > }
>
> Rewrite is expected to set r->uri, which in turn expected to
> contain path component of a full URL.  It is bad idea to introduce
> flags which allow to violate this.
>
> Instead, if you need an ability to better control request line
> used, you may want to address this in proxy module.
>
> --
> Maxim Dounin
> http://nginx.org/en/donation.html
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20130322/d659dcf8/attachment.html>


More information about the nginx-devel mailing list