Increasing the TTL in the expiration headers

In a previous topic about the max storage period of files, we were informed that Cloudflare stores the files for one month. This may explain why the headers issued to the end users are 31d.

However, this figure is considered low and is being heavily penalised in the metrics about the quality of our sites.

I think we should be able to issue headers for about 1 year to be on the safe side.

This is irrelevant to what Cloudflare is doing. I mean Cloudflare can stop storing for economy reasons the files in a month. But the user who visits the site after two months, should be using his locally stored file (if available). If the header is set to 1month, he will have to re-issue the request!

I hope this makes sense.

That’s not correct.

Low by whom? Penalized in what way?

Have you tried? Works fine for me.

1 Like

Penalised by tools that measure performance like


or this

and last, but not least, this:

I have added this instructions in my origin server:

ExpiresActive On
ExpiresDefault “access plus 5 seconds”
ExpiresByType image/x-icon “access plus 604800 seconds”
ExpiresByType image/jpeg “access plus 604800 seconds”
ExpiresByType image/png “access plus 604800 seconds”
ExpiresByType image/gif “access plus 604800 seconds”
ExpiresByType application/x-shockwave-flash “access plus 604800 seconds”
ExpiresByType text/css “access plus 604800 seconds”
ExpiresByType text/javascript “access plus 604800 seconds”
ExpiresByType application/javascript “access plus 604800 seconds”
ExpiresByType application/x-javascript “access plus 604800 seconds”
ExpiresByType font/truetype “access plus 604800 seconds”
ExpiresByType font/opentype “access plus 604800 seconds”
ExpiresByType application/x-font-woff “access plus 604800 seconds”
ExpiresByType application/x-font-woff2 “access plus 604800 seconds”
ExpiresByType image/svg+xml “access plus 604800 seconds”
ExpiresByType application/vnd.ms-fontobject “access plus 604800 seconds”
ExpiresByType text/html “access plus 600 seconds”
ExpiresByType application/xhtml+xml “access plus 600 seconds”

Can you please advise on how I can add custom headers in my Cloudflare configuration (to override the default)? I am a newbie here.

Thank you so much.

What’s your Browser Cache TTL setting on the Cache page for your domain at dash.cloudflare.com? I set mine to 6 months, and don’t get those warnings from testing tools. You can also try setting it to Respect Origin Headers.

3 Likes

Oh dear! Indeed that (1 month) was the value in my dashboard.

Just changed it to 1year!

Thank you so much!

1 Like

Here is the immediate difference in the evaluations:

That’s a 7 day cache value. 7 would have been worse than the month set previously.

Glad you got it sorted, but that’s just a ‘game score’ and not one which would change end user experience. Be mindful it’s now possible you’ll need to force a cache purge for long tail but popular assets if they ever change.

3 Likes

Yes thank you. Basic arithmetic I know :slight_smile:

I have them low in my server because we are still tuning it and making changes to the code. But at the same time we also try to measure performance.

My point previously was that even this setting was not valid and (possibly) was overwritten by the Cloudflare policy (and that was the case). I read the previous message (about the default storage period) and confused the two.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.