query part included in location match after rewrite (bug or feature?)
francis at daoine.org
Fri Sep 13 13:19:36 UTC 2013
On Fri, Sep 13, 2013 at 08:48:55AM -0400, aldem wrote:
> 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:
My reading of this is that you must give rewrite an explicit ? to mark
the query string, so a ? within a variable *is* part of $uri if it comes
before a ?. If you want to have your own query string, or to lose the
original query string during the rewrite, you must use an explicit ?.
> 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.
? is a valid character in a normalised uri. ? is special in an escaped
uri, since it marks the query string. "rewrite" creates a normalised uri
(at least, when given variables to expand).
I'd say "expected", unless there's an example where "rewrite" does not
create a normalised uri.
Francis Daly francis at daoine.org
More information about the nginx