Welcome! Log In Create A New Profile

Advanced

Re: unparsed_uri setting in ngx_http_subrequest?

Maxim Dounin
February 27, 2010 06:18AM
Hello!

On Fri, Feb 26, 2010 at 11:57:36AM -0800, Brian Pane wrote:

> 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 is believed to be right thing to do. Unparsed uri is one got
from client, and it shouldn't change on internal redirects and
subrequests.

> 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
> /prefix/foo.
>
> Is that a bug, or is it the intended behavior?

It's (mis?)feature of proxy_pass used with variables. Until
0.8.25 it was required to construct full url there. In 0.8.25 it
was changed to use $request_uri if only hostname is given.

Most likely it should follow the same pattern as others when
working with r->unparsed_uri, i.e. don't use it unless it's valid
and don't use it in subrequests (see ngx_http_proxy_create_request()
for an example).

Maxim Dounin

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

unparsed_uri setting in ngx_http_subrequest?

Brian Pane 3302 February 26, 2010 03:00PM

Re: unparsed_uri setting in ngx_http_subrequest?

agentzh 1263 February 26, 2010 11:04PM

Re: unparsed_uri setting in ngx_http_subrequest?

Maxim Dounin 1557 February 27, 2010 06:18AM

Re: unparsed_uri setting in ngx_http_subrequest?

Brian Pane 1287 February 27, 2010 12:42PM

Re: unparsed_uri setting in ngx_http_subrequest?

Maxim Dounin 1151 February 27, 2010 01:18PM

Re: unparsed_uri setting in ngx_http_subrequest?

Brian Pane 1423 February 27, 2010 01:36PM

Re: unparsed_uri setting in ngx_http_subrequest?

Maxim Dounin 1216 February 27, 2010 01:58PM

Re: unparsed_uri setting in ngx_http_subrequest?

Brian Pane 1612 February 27, 2010 02:26PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 95
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready