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.