Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use nginx to add Domain to a Set-Cookie

Tags:

nginx

cookies

Is it possible to use nginx to add Domain= to a Set-Cookie (from a reverse proxied / back end server) when the Set-Cookie does not already have a Domain? I am aware of proxy_cookie_domain, but I can't figure out how to use it to add the Domain if it does not already exist on the Set-Cookie header from the back end.

I tried

proxy_cookie_domain ~^$ a.b.com;

but that did not work.

like image 841
Mitch Avatar asked Apr 10 '17 23:04

Mitch


Video Answer


1 Answers

It is possible by dirty hack. Assuming that path is set inside your cookie You can:

proxy_cookie_path ~^(.+)$ "$1; domain=yourdomain";
like image 116
snieguu Avatar answered Nov 15 '22 03:11

snieguu