Can nginx location
blocks match a URL query string?
For example, what location block might match HTTP GET
request
GET /git/sample-repository/info/refs?service=git-receive-pack HTTP/1.1
httpnginx
Can nginx location
blocks match a URL query string?
For example, what location block might match HTTP GET
request
GET /git/sample-repository/info/refs?service=git-receive-pack HTTP/1.1
Best Answer
Short answer: No.
Long answer: There is a workaround if we have only a handful of such location blocks.
Here's a sample workaround for 3 location blocks that need to match specific query strings:
You may use $query_string, $args or $arg_fieldname. All will do the job. You may know more about error_page in the official docs.
Warning: Please be sure not to use the standard HTTP codes.