We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Cloudflare Cache Rule for bypassing caching for preview pages?

Development and Programming

bsrweb's avatar
bsrweb
24 posts
3 months ago
bsrweb's avatar bsrweb

Speaking of Cloudflare…can anyone share their Cloudflare Cache Rule for bypassing caching for preview pages?

In my template, if an entry is in “Draft” status, I’m using this tag: {exp:http_header cache_control="no-store"}.

I can verify that I see this in the response header on my dev site but on production, Cloudflare ignores the cache-control header. It must be something in my Cache Rules?

       
Hop Studios's avatar
Hop Studios
499 posts
3 months ago
Hop Studios's avatar Hop Studios

ExpressionEngine’s default headers always ask for no caching, so setting a header specifically for a preview should not be necessary. This is true regardless of what cache settings (in EE) you’re using, even serving CSS or js templates.

So yes it’s likely cloudflare settings or something else somewhere between EE and the browser.

https://docs.expressionengine.com/v6/development/legacy/libraries/output.html#set_headerheader-replace–true is vaguely useful but this isn’t really spelled out in the docs anywhere

       
User 134G0Omip's avatar
User 134G0Omip
2 posts
2 months ago
User 134G0Omip's avatar User 134G0Omip

(responding to an old msg, but whatevs) Are you using specific templates for previews? We bypass caching for both “cache eligibility” and “browser TTL” settings using a rule targeting the preview template (and make sure that EE doesn’t cache that template, as well).

       
User Sv1pZ58J's avatar
User Sv1pZ58J
1 posts
one month ago
User Sv1pZ58J's avatar User Sv1pZ58J

i look for cookies, which only CMS users have

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.