0

Is there a way to black list cookies purely through Nginx?

I tried this: https://stackoverflow.com/questions/67548886/remove-specific-cookie-in-nginx-reverse-proxy

But it doesn't seem to cover cases where there are multiples of the same cookie and it is not great performance wise

Isn't there a built in way to do this?

1 Answers1

0

There are no builtin tools in nginx for managing cookies (other than the proxy tools for changing the domain/flags/path).

While it should be possible to achieve the logic of what you ask using the generic regex based rewrites, if the performance is already an issue then you'll need some middleware to process the data. An embedded lua script might be a bit faster.

If we are talking about a reverse proxy configuration, then it would be simpler/faster to kill the set-cookie header in the responses.

Really, stripping out cookies on a proxy is a kludge and you should be trying to fix this at the origin.

symcbean
  • 21,009
  • 1
  • 31
  • 52