I find myself confused by two points, despite a lot of documentation. I’m hoping someone can help me to understand a couple of things. As a point of reference, we moved from using Varnish in front of WP to using Cloudflare.
With page rules, it says only one rule will be applied per matched pattern. It also says that the “Always Use HTTPS” page rule has to be set alone, i.e. you can’t add other settings with it in the same page rule. So, say I have a page rule set as #1 that says “match against http://mydomain.com/” and apply the Always Use HTTPS rule. I then also want to set a rule for a subdomain matching “mysubdomain.mydomain.com/*” for caching. Does this mean that if I put my subdomain rule first and someone hits that url it will only have the caching page rule associated with it and then not the HTTPS rule, and vice versa? How would you then manage to both apply the HTTPS rule to everything, and also specify caching behavior?
I just set Cloudfront up in front of a Wordpress installation that I don’t manage. From that installation I can see that there are headers set that prevent caching
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
In Varnish I was able to specifically unset headers from the origin and set them to what I needed. The things I’ve read in the CF docs say both that:
- Cloudflare will automatically cache files with a specific set of extensions, unless the cache-control headers explicitly say not to, in which case it will not cache anything
- You can cache anyway by using a combination of Cache Everything and Edge Cache TTL
My question there is, how exactly can I override the headers coming from Wordpress to allow caching?