A
A
Andrey2015-08-12 15:05:49
Nginx
Andrey, 2015-08-12 15:05:49

How to clear cookies when proxying with nginx?

Solution in the comments to the tagged answer
We are using nginx as a frontend.
Our main domain is company.ru and the site on it works only on https.
On the pages of this domain, sometimes it is necessary to insert frames of partner sites.
Because Partners don't always support SSL, to get around protocol mismatch issues, we proxy partner sites through our nginx.
Thus, the partner site receives the address https://partner.company.ru
. Our authorization cookie is issued for the address .company.ru, i.e. partners can get its value on their server.
How to kill this cookie when proxying?
I know what can be done
proxy_set_header Cookie "";
But this option will clear the cookies completely, which calls into question the performance.
You need to reset the cookie with a specific name.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2015-08-12
@airbreaker

Set your cookie to company.ru, not to .company.ru, and then the browser will not transfer the cookie to *.company.ru
. And it is most reliable to make a separate domain for these cases.

E
evnuh, 2015-08-12
@evnuh

Maybe this module will help? https://github.com/openresty/headers-more-nginx-module

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question