Ignore Cookie for Caching

We’re running our application on EKS behind an nginx ingress, I need a persistent http connection to support certain types of messaging i.e. we need to ensure that a session is always directed back to the same pod on the cluster. For that use case I’m using session affinity - this works by setting a cookie.

For some reason the way session affinity works with the nginx ingress, is that it sets that cookie in every single response. The trouble is that this causes Cloudflare to bypass the cache for everything.

Is there any way to ignore cookies or a cookie, when caching?

Cloudflare Business or Enterprise plan has Bypass cache on cookie page rules

Or if you want to only cache when a cookie is available with CF Biz/Enterprise plans

or you can use CF Worker to write your own bypass cache on cookie setup

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.