I want to use the new cookie-prefixes, which are not yet standardized by the IETF. These are __Secure-
and __Host-
.
So let's e.g. set this cookie (here the header returned by the server):
Set-Cookie: "__Host-apple=yummy; Secure; HttpOnly; Path=/"
I want to access this cookie now in nginx with the $cookie-
variable. So for testing I use the echo module to show me the value of the cookie:
location = /wannaeat/ {
echo $cookie___Host-apple;
}
However nginx always shows me -apple
. It seems to use the hyphen (-
) to split the variable.
Because when I e.g. name the cookie __Host_apple
(and the nginx variable $cookie___Host_apple
) nginx shows me the value correctly.
I know I could probably use $http_cookie
and use a regular expression to find the correct cookie, but this is not possible as I want to map
the cookie value.