unparsed_uri setting in ngx_http_subrequest?

Brian Pane brianp at brianp.net
Fri Feb 26 22:57:36 MSK 2010

In ngx_http_subrequest, the newly initialized subrequest's
unparsed_uri is set to the same value as the parent request's
unparsed_uri.  (I'm looking at 0.8.33.)

This interacts in a bad way with the proxy module.  The proxy code
that builds the request to the upstream, in ngx_http_proxy_eval, uses
the subrequest's unparsed_uri, rather than its uri.

The result is that, if a request for /prefix/foo creates a subrequest
for /prefix/bar, and the server has been configured to proxy /prefix/*
to some upstream, the subrequest will result in an upstream request
for /prefix/foo (the same URI as the parent request) rather than

Is that a bug, or is it the intended behavior?


More information about the nginx-devel mailing list