CloudFlare Page Rules for Caching

Rayman

Member
I currently have page rules to cache the following:
  • /proxy.php?image*
  • /css.php*
  • /attachments/*
  • /styles/*
I am wondering, should I also create page rules to cache the following?
  • /internal_data/*
  • /data/*
  • /js/*
 
I probably wouldn't cache "/attachments/*" because then they won't be checked for permissions. This means attachments in conversations could be linked and shared with anyone. No need to cache "/internal_data/*" either as files in that folder should never be accessed directly.

I believe all of the others are fine.
 
Some may disagree with this, but I've being playing around with Cloudfare for a while now and the below is what seems to work the best.

If you don't include some of the other directory folders then when your server goes offline there will not be a complete snapshot of your site available until it comes back. Just don’t include the install folder.

You will see a slight speed increase if you include the library folder, but the cache level must be set to Standard and not to Cache Everything. That is very important. The rest can be set to Cache Everything except for the ones where you are forcing Always Use HTTPS. I am using Cache Level: Bypass for those.

http://*cpanel.mydomain.com/*
Always Use HTTPS

*cpanel.mydomain.com/*
Disable Security, Browser Integrity Check: Off, Server Side Excludes: Off, SSL: Flexible,
Web Application Firewall: Off, smart_errors: Off, Rocket Loader: Off, Browser Cache TTL:
a day, Mirage: Off, Always Online: Off, Security Level: Essentially Off, Cache Level:
Bypass
, Edge Cache TTL: a day, IP Geolocation Header: Off, Email Obfuscation: Off,
Disable Apps

http://*mydomain.com/admin.php*
Always Use HTTPS

*mydomain.com/admin.php*
Disable Security, Browser Integrity Check: Off, Server Side Excludes: Off, SSL: Flexible,
Web Application Firewall: Off, smart_errors: Off, Rocket Loader: Off, Browser Cache TTL:
a day, Mirage: Off, Always Online: Off, Security Level: Essentially Off, Cache Level:
Bypass
, Edge Cache TTL: a day, IP Geolocation Header: Off, Email Obfuscation: Off,
Disable Apps

*mydomain.com/data/*
Browser Integrity Check: Off, Server Side Excludes: Off, SSL: Flexible, Web Application
Firewall: Off, smart_errors: Off, Rocket Loader: Off, Browser Cache TTL: a day, Mirage:
Off, Always Online: On, Security Level: Essentially Off, Cache Level: Cache Everything,
Edge Cache TTL: a day, IP Geolocation Header: On, Email Obfuscation: Off

*mydomain.com/internal_data/*
Browser Integrity Check: Off, Server Side Excludes: Off, SSL: Flexible, Web Application
Firewall: Off, smart_errors: Off, Rocket Loader: Off, Browser Cache TTL: a day, Mirage:
Off, Always Online: On, Security Level: Essentially Off, Cache Level: Cache Everything,
Edge Cache TTL: a day, IP Geolocation Header: On, Email Obfuscation: Off

*mydomain.com/js/*
Browser Integrity Check: Off, Server Side Excludes: Off, SSL: Flexible, Web Application
Firewall: Off, smart_errors: Off, Rocket Loader: Automatic, Browser Cache TTL: a day,
Mirage: Off, Always Online: On, Security Level: Essentially Off, Cache Level: Cache
Everything, Edge Cache TTL: a day, IP Geolocation Header: On, Email Obfuscation: Off

*mydomain.com/library/*
Browser Integrity Check: Off, Server Side Excludes: Off, SSL: Flexible, Web Application
Firewall: Off, smart_errors: Off, Rocket Loader: Off, Browser Cache TTL: a day, Mirage:
Off, Always Online: On, Security Level: Essentially Off, Cache Level: Standard, Edge Cache
TTL: a day, IP Geolocation Header: On, Email Obfuscation: Off

*mydomain.com/styles/*
Browser Integrity Check: Off, Server Side Excludes: Off, SSL: Flexible, Web Application
Firewall: Off, smart_errors: Off, Rocket Loader: Off, Browser Cache TTL: a day, Mirage:
Off, Always Online: On, Security Level: Essentially Off, Cache Level: Cache Everything,
Edge Cache TTL: a day, IP Geolocation Header: On, Email Obfuscation: Off

*mydomain.com/proxy.php?image*
Browser Integrity Check: Off, Server Side Excludes: Off, SSL: Flexible, Web Application
Firewall: Off, smart_errors: Off, Rocket Loader: Off, Browser Cache TTL: a day, Mirage:
Off, Always Online: On, Security Level: Essentially Off, Cache Level: Cache Everything,
Edge Cache TTL: a day, IP Geolocation Header: On, Email Obfuscation: Off

*mydomain.com/css.php*
Browser Integrity Check: Off, Server Side Excludes: Off, SSL: Flexible, Web Application
Firewall: Off, smart_errors: Off, Rocket Loader: Off, Browser Cache TTL: a day, Mirage:
Off, Always Online: On, Security Level: Essentially Off, Cache Level: Cache Everything,
Edge Cache TTL: a day, IP Geolocation Header: On, Email Obfuscation: Off
.
 
Last edited:
Since my forum runs on a managed dedicated server without root access, I unfortunately cannot further optimize the loading times of the server. Not even OPcache or Redis are possible. So I wanted to ask how it looks with the Cloudflare Caching Function (Page Rules)? Would that be an alternative function that could improve my TTFB, for example?
 
Top Bottom