I have a website, say example.com and require CloudFlare to redirect all traffic from http to https for loads of wildcard subdomains (inc. www); AND the apex (i.e. @ or /) but NOT for for a set of subdomains which are actually CNAMES to 3rd party services for which https is not acceptable e.g.
http://mail.example.com
http://calendar.example.com
http://drive.example.com
http://xyz.example.com
N.B Redirecting to the https protocol for those is not viable as it's not supported by those 3rd party services.
Looking into this, this question solved half my problem. The relevant answer pasted below:
According to Source A;
Page Rules are applied in the order that they are listed. So, all you would have to do is put the bypass cache first and then the cache >everything rule:
nope.example.com/ (Bypass)
example.com/ (Cache Everything)
Each TLD domain cannot have more than 3x Page Rules though, so listing my http only subdomains as individual Page Rules is not possible.
Is it possible to create CloudFlare Page Rule with a logical OR in to target traffic for a specific whitelist of subdomains?
My thinking is perhaps I could express several rules in one string by using a RegEx to target each of the http only subdomains from within one Page Rule.
e.g. as pseudo code with invalid syntax:
http://mail||calendar||drive||xyz.example.com
How would one go about creating a valid RegEx to achieve this?
Thanks
The answer to my question is in fact:
I discovered that currently; CloudFlare Page Rules do not support RegEx, Glob or any sort of negation. You can only use basic wildcard * or $1 to pass params.
It appears that if you have the same use case as me you have to just cough up enough money to get more Page Rules and explicitly list all the domains you need a rule for.
Current Rules pricing; 20$ for 20x, $200 for 50x, $$$X for NX - https://www.cloudflare.com/plans
It appears that if you have the same use case as me you have to just cough up enough money to get more Page Rules and explicitly list all the domains you need a rule for. Current Rules pricing; 20$ for 20x, $200 for 50x, $$$X for NX...
Page Rules are now available to purchase a la carte, outside of plan upgrades.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With