location regular expression not filtering some characters

Francis Daly francis at daoine.org
Tue Jun 19 18:13:10 UTC 2012


On Tue, Jun 19, 2012 at 01:07:17PM -0400, CM Fields wrote:

Hi there,

>    http://example.com/data/12#34.txt
>           and cuts off the pound sign and anything after it to this....
>    http://example.com/data/12

The client probably should not send the # or anything after it, as it
is the local "fragment" part of the url. nginx is right to ignore it,
if it present. If you want a # in a url, it must be %-encoded.

>    http://example.com/data/12?34.txt
>        get passed through the regular expression unchanged
>    http://example.com/data/12?34.txt
> 
> Not sure why the question mark is special yet.

The ? marks the start of the query_string part of the url. If you want
a literal ? in a url, it must be %-encoded.

In practice, the query_string is usually an unordered set of key/value
pairs. The choice nginx makes is not to consider the query_string when
determining which location{} is the best fit.

You can test variables with names that include "arg" if you want to see
what query_string was provided -- but you can't do it as part of the
location directive.

http://nginx.org/en/docs/http/ngx_http_core_module.html#variables

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list