How use Nginx variable $cookie_ with dot (point) cookie, like "foo.bar" If i write "$cookie_foo.bar" in access log file i have "-.bar"
The WONTFIX comment on @aorth's bug's resolution is supremely unhelpful, and I'm still flabbergasted that Nginx just refuses to accommodate perfectly legal characters in cookie names. They could just replace the "magic" nginx chars in cookie names with underscores, or make you escape "magic" chars, or any number of other ways people have already solved similar problems.
It's not rocket surgery, Nginx.
Anyhow, this is how I wound up extracting the value for a cookie named foo.lang that my devs put in a critical app:
map $http_cookie $foo_lang_cookie {
default "";
"~foo\.lang=(?<foo_lang>[^;]+)" $foo_lang;
}
Hopefully my hours of fruitless Googling and beating my head against the wall can benefit other lost souls who find their way here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With