1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CloudFlare Page Rules for Caching

Discussion in 'Server Configuration and Hosting' started by Rayman, Apr 7, 2016.

  1. Rayman

    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/*
     
  2. Jeremy P

    Jeremy P Well-Known Member

    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.
     
  3. RSI

    RSI Active Member

    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: Jun 15, 2016

Share This Page