How do you access HTTP GET parameters in Nginx prior to version 0.7.8?
-
03-07-2019 - |
Question
The changelog lists version 0.7.8 as the version that introduces the $arg_X
notation to access the HTTP GET parameter X
from within nginx.conf
.
Unfortunately, the wiki is very up to date. How do you access HTTP GET parameters from within nginx.conf
before this version?
Solution
At the moment, the best I have is matching against $args
.
For instance, instead of saying if ($arg_user = "jim")
you can say if ($args = "user=jim")
. This particular example only works for a single argument, since multiple arguments can come in any order; that case should be handled with regular expressions.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow