0

I am having problems getting my ExpressionEngine website to cache on Cloudflare.

I am running: - ExpressionEngine 2.11.7 - PHP 5.4 / MySQL 5.5 - IIS 7.0.

Let me run through steps I am taking:

  • On Cloudflare, I have the rule .domain.com/ to be cached i.e. everything is being cached.
  • After doing curl -I on https://www.domain.com/ I noticed the response was coming back with cf-cache-status: MISS. I then tried https://www.domain.com/page/ and I got the same response. /page/ is a template created inside ExpressionEngine.
    • If I create a test page https://www.domain.com/cachetest.php i.e. not ExpressionEngine, it caches that page absolutely fine. So it isn't an IIS configuration, and it isn't the web server, or otherwise I would expect that page not to cache.
    • my web.config file strips out index.php, which I thought might have caused the issue, but I have tried with and without that rule but still not working.
    • I have checked over my output caching in IIS and although caching is enabled, there are no rules. As a 'to be sure', I disabled caching to test again.

Am I missing something? Is there a setting that could be preventing Cloudflare to cache the website for some reason? I have no issues with Wordpress sites using Cloudflares cache, using the same settings.

Thanks in advance,

EDIT I've just found this on the Cloudflares support page (https://support.cloudflare.com/hc/en-us/articles/202775670-How-Do-I-Tell-Cloudflare-What-to-Cache-):

or if there is a cookie in the response, then Cloudflare will not cache the resource.

If I look at the response in Curl, well we see the exp_last_visit, exp_last_activity, exp_tracker, exp_csrf_token cookies in the response headers.

So does this mean we cannot use ExpressionEngine with Cloudflare?

0

I figured it - in Cloudflare, you need to also enable Edge Cache TTL on the same rule. But be sure to disable for your admin pages!

| improve this answer | |
0

A solution might be to switch to feeding cloudflare with a static cache version of EE: the static pages won't hit your EE server at all, and so you shouldn't have a problem with cookies for those pages.

An easy way to get this working is to use the static cache features of Stash, Mustache for automatic cache clearing rules, and the free Cloudflare module for Stash.

HTH

| improve this answer | |
  • Ooo great, thank you for this - I will have a look now. – AmmyKami83 Jul 17 '18 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.