I figured out a simple solution so thought to share it ( to get feedback
or
may be to help ). In an earlier discussion I got to know about map and
why
one should avoid to use if an try to use map.
http {
map $cookie_abt $abt {
default "abt=a;Path=/";
~.+$ "";
}
server {
listen 8081;
location / {
add_header Set-Cookie $abt;
...
}
}
}
the map returns “” ( empty ) if cookie is already else the cookie value
(
abt=a;Path=/" ). The good news is add_header Set-Cookie “” does not set
any
cookie and we are good to go
HTH
Any feedback?
Posted at Nginx Forum: