Webmasters Asked on December 8, 2021
I’m using Cloudflare to cache certain APIs. I’m setting the below headers in my Origin server:
Cache-Control: public, must-revalidate, max-age=300
Basically, I’m instructing the browser here to cache the response for 5 minutes. Along with these headers I also send an etag across.
After 5 minutes , I get the latest request and check its Etag headers. If they match, my origin server sends back an HTTP 304.
But Cloudflare isn’t proxying back an HTTP 304 but an HTTP 200 back to the browser making the browser download the response again despite there being no change.
These are the response headers I get back from Cloudflare:
cache-control: public, must-revalidate, max-age=300
cf-cache-status: REVALIDATED
server: cloudflare
status: 200
vary: Accept-Encoding
But I can see from my server logs that there is an HTTP 304 sent back. Why is CF still sending an HTTP 200 to my browser. Is there something I need to modify in my cache headers?
So i found a workaround for this - i had to add the disable-performance
page rule to cloudflare. Now i seem to be correctly getting a HTTP 304 in the browser.
Answered by Kannaj on December 8, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP