What is the name of the domain?
Prefer not to say
What is the issue you’re encountering
Origin cache control with Set-Cookie forces cache status to be BYPASS
What steps have you taken to resolve the issue?
I’ve tried turning on Cache Everything to force caching the requests with the Set-Cookie
header, but this way I override the origin Cache-Control
header directives, which is not what I want.
What are the steps to reproduce the issue?
- Have a server return some
Cache-Control
headers - Enable Origin Cache Control
- Add a
Set-Cookie
header to the same requests - The cache status will be BYPASS
I understand that this is the default behavior. As written in the docs:
If origin cache control is enabled, Cloudflare does not cache the asset and preserves the Set-Cookie. A cache status of BYPASS is returned.
My question is how to opt out of this behavior. In my case, this Set-Cookie
provides a cookie intended to enable session stickiness, meaning that a user gets served content from the same server. For example:
- Server responds with
Set-Cookie: instance_id=123
andCache-Control: max-age=180, s-max-age=180
- There’s a Custom Cache Key based on the
instance_id
, fragmenting the cache for each individual instance - All clients who’re served that page from that edge see the cached pages of that particular instance for the next 3 minutes
In other words, I want the default Origin Cache Control behavior when Set-Cookie
is not present, but when I do have a cookie. Is this possible?