I\'d like to match question mark \"?\" as regexp on nginx.conf location.
For example, a URL pattern which I\'d like to match is /something?foo=5 or /something?bar=8 (par
nginx location block doesn't match query string at all. So it's impossible.
Location
This directive allows different configurations depending on the URI.
In nginx, there is a built-in variable $uri, which the location block is matched against. For example, give a request
http://www.example.com/app/login.php?username=xyz&password=secret
the $uri value is this string:
/app/login.php
and the query_string is stored in nginx variable $args:
username=xyz&password=secret
To do something wrt. query string, you can do something like
if ($args ~ username=xyz) {
# do something for requests with this query string
}
But be careful, IF is Evil