Cache not working (Bypass returned)

Hi,
Caching of static assets (which should be done automatically) doesn’t seem to be working for my site. I have set the correct cache control headers, but I’m still seeing “bypass” returned in the cf-cache-status.

There are also no page rules, I tried ‘Cache Everything’ in page rules for testing (I don’t actually want this feature) but that also did not work. Do you know how I can resolve this?

Interestingly, the browser (chrome) is adding a no-cache request header… and firefox adds a ‘max-age=0’ cache control header… but that seems to be default browser behavior.

Maybe some framework (or extension) is adding the request headers? I’ve never seen the browser itself modify/add those headers, maybe try an incognito/private session to try without any extensions.

I’m using Node JS with Express as the only framework(s), I tried incognito and different computer… still the same result, which is odd.

You wouldn’t happen to be using Dev Tools with Disable Cache activated, would you?

If you want us to take a deeper look, post the URL.

I just figured it out and it’s probably a niche case. I came across this thread where it was pointed out “If the Cache-Control header is set to “private”, “no-store”, “no-cache”, or “max-age=0”, or if there is a cookie in the response, then Cloudflare will not cache the resource.”

Looking at the response above, there are 2 cookies being set, these are from AWS “sticky sessions” which is an optional feature I had on the server side. I disabled this and it fixed the issue:

image

Thanks for the suggestions nontheless.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.