• Resolved fredpan

    (@fredpan)


    Hi,

    I am new to this plugin.

    I want to have a very short TTL for the HTML, saying 60s, and a much longer TTL for static contents like JS or CSS.

    This plugin is the only one I use regarding caching, and below is my situation:

    1. If I choose “Respect Existing Headers” in Cloudflare, there will be no cache-control for my static contents. But the HTML can have: “cache-control: s-maxage=31536000, max-age=60”.

    2. If I specify a browser TTL in Cloudflare, saying 30 minutes, both of the HTML and the static resources will have “cache-control: max-age=1800, s-maxage=31536000”.

    What I want to achieve is to have:

    “cache-control: s-maxage=31536000, max-age=60”. for HTML, and
    “cache-control: max-age=1800, s-maxage=31536000” for JS/CSS/font etc.

    Any idea about how to do that?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter fredpan

    (@fredpan)

    I enabled “Add browser caching rules for static assets”…

    Is it how we are supposed to do in order to achieve the one I want?

    In addition, if this is the correct way, how can we set the TTL for those static assets caches?

    Plugin Contributor iSaumya

    (@isaumya)

    I enabled “Add browser caching rules for static assets”…
    Is it how we are supposed to do in order to achieve the one I want?

    – Yes. Inside the cloudflare the TTL will always be respect header and then this plugin will set the cache control for the dynamic HTML requests where by enabling the add browser caching rule, it will add cache control for static files.

    If you are using apache or lightspeed server you will see that when you enable that option it has added the best cache control for all the static file types in your htaccess file. Take a look at the htaccess file.

    If you are on nginx then the plugin created a nginx.conf file inside /wp-content/wp-cloudflare-super-page-cacge/<domain-name>/ which you can include to your main nginx.conf file in the server or you can copy the contents of that file and put it in your main nginx.conf file.

    Thread Starter fredpan

    (@fredpan)

    Hi Saumya,

    Thanks for the reply. Yes, the plugin now works as expected.

    Last question, for the Fallback cache, what value should I set for “Fallback cache TTL”? I saw the default value is “0”, does it mean the cache will always be valid until any change made on my website? And if the change been made, both the fallback cache and the Cloudflare cache will be purged automatically?

    In addition, do you suggest me to turn “Save response headers” on?

    Plugin Contributor iSaumya

    (@isaumya)

    “Fallback cache TTL”? I saw the default value is “0”, does it mean the cache will always be valid until any change made on my website? And if the change been made, both the fallback cache and the Cloudflare cache will be purged automatically?

    – Yes this means the fallback cache won’t be automatically deleted after some time. Instead when you update the content then the fallback cache & Cf cache will be purged.

    do you suggest me to turn “Save response headers” on?

    – Not needed unless you want to store some custom response headers.

    Thread Starter fredpan

    (@fredpan)

    Okay,thanks a lot 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to setup different TTLs for HTML and Static Resources’ is closed to new replies.