Amit Kothari
Amit Kothari

Reputation: 530

Control caching and CDN on Cloudflare when SSL is forced "on" via a page rule

This question is specifically about page rules in Cloudflare, which allow you to specify wildcard patterns on your site using rules - and handle each pattern differently.

One of the patterns is "Force SSL" - in effect, any request that matches that pattern will be forced down the path of https:// - whether that's Flexible SSL or otherwise.

The problem with choosing this option is that all other options over the CDN/cache time, etc. disappear.

This raises some obvious issues to which I've found no clear answer:

I would like Cloudflare to re-direct my visitors from http:// to https:// automatically as opposed to do it on my app, because the various apps on my domain (Wordpress included) have various quirks that make configuring each one both tedious and error-prone.

Upvotes: 2

Views: 1546

Answers (2)

Yosi Taguri
Yosi Taguri

Reputation: 1388

you can add another rule for caching for https - the first rule would be to divert all http to https with another rule right after that to handle the https traffic.

Upvotes: 2

damoncloudflare
damoncloudflare

Reputation: 2087

"If Cloudflare serves a https:// resource, does it still cache static resources?" Yes. It doesn't matter if it is http or https://

What CloudFlare caches by default

"How do I control the nature of the resources cached? In other words, the settings equivalent to "Simple" caching, and "Aggressive" caching." By using those settings in your performance settings.

"Is it possible to set "Cache Everything" when serving requests over https://? It certainly exists on the http:// equivalent."

I would actually recommend not doing cache everything, really. While it is an option that is available, you could have issues with users that have to sign in, etc.

"Is there any ability to set options such as cache expiry, time that they reside on edge servers before expiration, etc?" You can set a browser cache TTL in your performance settings; we should also honor the expire headers you have set on your server.

Upvotes: 0

Related Questions