upstream proxy support

Francis Daly francis at
Sat Mar 23 13:01:35 UTC 2013

On Sat, Mar 23, 2013 at 12:00:02PM +0000, nginx-devel-request at wrote:

Hi there,

if I can barge in to the thread...

> so, if i understand you correctly you prefere a more general solution
> allowing to alter the $uri controlled by a boolen flag defined in the proxy
> module and in my case read by the rewrite module. But this way the rewrite
> module will depend on the proxy module, right?

As I understand things (as an onlooker):

Right now,

  proxy_pass http://example/bar;

means, approximately, (1) speak http not https; (2) use the upstream{}
called example, or dns-resolve example, to find the IP address to connect
to; (3) issue a http request that is something like

  GET /bar/something HTTP/1.0
  Host: example

(Read the Fine Source for the full details, and how other directives
can change things there, if it matters.)

The suggestion seems to be that you could create a new
proxy_ directive to adjust the "GET" line that is sent, to add
"http://your-preferred-hostname" in the right place. You may also want
it to cause the Host: header to be modified, as well as whatever else
your upstream and the rfc deem necessary.

No rewrite/proxy linkage. No change to rewrite at all.

> or do you not intend to add a fix for the "forward proxy problem" at all?

Right now, proxy_pass speaks http to a http server, or http-over-ssl to
a https server. It doesn't speak proxied-http to a http proxy server.

Adding that new protocol is not currently an nginx priority.

You seem to have a config file workaround for the current version;
if that's good enough for you, then great!

If not, then you'll probably want a module or patch to add support for
"proxied http" as a protocol that nginx speaks as a client.

If it does just enough to get your use case working, it is unlikely
to be added to stock nginx. If it cleanly and correctly implements the
protocol without impacting non-users, then it is more likely to be useful
for more people.

I haven't followed the mailing lists for very long, but I don't recall
any other request for nginx to be a client of a http proxy. That suggests
that it may not be a widely-requested feature.

But if it is useful for you, and you can get it written, then there's
no reason why it can't be kept working in future versions.

All the best,

Francis Daly        francis at

More information about the nginx-devel mailing list