How to access query parameter names with '-' in it

Francis Daly francis at
Wed Nov 12 22:43:53 UTC 2014

On Wed, Nov 12, 2014 at 03:38:03AM -0500, sudarshan wrote:

Hi there,

> If query parameters in the request looks like this
> /something.cgi?param_name=1&param-name=2
> I can access 'param_name' as $arg_param_name. How do I access 'param-name'
> though? $arg_param-name will not work since as far as nginx is concerned the
> variable name ends at $arg_param. Is there a workaround for this case? Has
> anyone else run into a similar problem?

If you want to avoid embedded languages, you could match-and-extract
from $args, either with a map or an if, to set your variable name to
the matching value in "&?param-name=([^&]*)".

But it might be less work to change the input to restrict itself to
nginx-friendly characters.

Francis Daly        francis at

More information about the nginx mailing list