Nginx - Black list cookies

dz flag

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

I tried this:

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?

ws flag

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.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.