embedded variable $cookie_YYY and "-" symbol.

Francis Daly francis at daoine.org
Mon Feb 18 12:35:18 UTC 2013

On Mon, Feb 18, 2013 at 03:54:33PM +0400, Igor Karymov wrote:

Hi there,

> set $uwaver $cookie_un-uwa-version;
> $uwaver always equal to "-uwa-version" string instead of real cookie value.
> maybe i should use some kind of escaping here?

I believe that the reason is that there are some characters which are
valid in cookie names, but which are not valid in nginx variable names;
and I believe that the only way to access them in nginx.conf is to parse
$http_cookie yourself.

There is a similar problem with the $arg_* variables.

Both the $cookie_ and the $arg_ variables are convenience features,
and they work well provided that you restrict your inputs appropriately.

I'm not sure how much work it would be to create a patch allow, for
example, ${var.iab-le} as a way of accessing a variable named like that;
but I guess that it has been "more work than just avoiding or working
around those variable names" for everyone who has hit the issue so far.

Francis Daly        francis at daoine.org

More information about the nginx mailing list