Rewriting the domain part of Set-Cookie in a proxy_pass

tobia nginx-forum at nginx.us
Wed Jun 8 17:16:05 MSD 2011


Hello

Does nginx (or a module) provide functionality equivalent to httpd's
ProxyPassReverseCookieDomain?

Long explanation: I have a simple nginx reverse proxy

server {
  server_name external.domain.com;
  location / {
    proxy_pass http://backend.int/;
  }
}

The problem is that Set-Cookie response headers contain
";Domain=backend.int", because the backend does not know it is being
reverse proxied. Therefore the users' browsers dutifully reject such bad
cookies.

How can I rewrite the content of the Set-Cookie response headers,
replacing ";Domain=backend.int" with ";Domain=external.domain.com"?

Unfortunately passing the Host header unchanged and reconfiguring the
virtual host table of the backend is not an option in this case.

Best,
Tobia

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,204971,204971#msg-204971




More information about the nginx mailing list