Welcome! Log In Create A New Profile

Advanced

query part included in location match after rewrite (bug or feature?)

September 13, 2013 08:48AM
Hi,

According to documentation, "location" matches only against URI path, ignoring query string. However, after "rewrite", when using variables containing "?" character (like $request_uri for illustration), query becomes part of $uri:

location /src/ {
rewrite ^ /dst$request_uri;
}

location /dst/ {
# At this point, $uri contains query part from /src, like /dst/src/?arg=val
add_header Content-Type text/plain;
return 200 "$request_uri $uri $args";
}

For request like "/src/?arg=val" the output will be: /src/?arg=val /dst/src/?arg=val arg=val

Thus, $uri (and matched part) contains query, and $args *also* contains query (inherited from original request). All together, this may lead to quite unexpected results in some configurations.

So, my question is - is this expected behavior (just undocumented) or is a bug? To me it looks like a bug - allowing matching anything past "?" in location and making it part of $uri.
SubjectAuthorPosted

query part included in location match after rewrite (bug or feature?)

aldemSeptember 13, 2013 08:48AM

Re: query part included in location match after rewrite (bug or feature?)

Francis DalySeptember 13, 2013 09:20AM

Re: query part included in location match after rewrite (bug or feature?)

aldemSeptember 13, 2013 09:48AM

Re: query part included in location match after rewrite (bug or feature?)

Francis DalySeptember 13, 2013 10:28AM

Re: query part included in location match after rewrite (bug or feature?)

aldemSeptember 13, 2013 10:51AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 83
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready