Cache-Control: immutable

We’d like our assets to return “immutable” property in cache-control header. Then it might be used by some browsers to mark assets that are not changed at all (Firefox, Edge and Safari, according to

I am aware that this has no influence on Cloudflare itself, but Cloudflare could just forward it to browsers - now it seems, that it’s removed.

Seems to get passed through

< snip >

I’m not able to go to cachecontrol.php as it redirects to main page and I can’t see any asset there returning with “immutable”…

You need to check the headers you receive, there’s “Cache-Control”

I see them. There’s for example " Cache-Control: public, max-age=14400"
No “immutable” added

Can you post a screenshot? I clearly have the header here.

OK, now I can see it being set for cachecontrol.php document. We are trying to set it for JS/CSS assets and unluckily it’s not being passed…

In that case it’s likely the server does not set them properly for those assets. I’d double check that.

We’ve got it set on our QA environment, which is not using Cloudflare and it’s returned like: " Cache-Control: public,immutable,max-age=31536000"
Then on our staging with Cloudflare, it’s stripped of “immutable”

I’d double check it on staging too :wink:

Maybe Cloudflare strips something, from the test above it would seem they dont but who knows :smiley:

Appreciate your help on this :slight_smile:
From official support I’ve got the response, that CF doesn’t support immutable, but I don’t know why would it be like that, as this is only to pass this header forward…
So I’m looking here if someone has any experience with this header.

Just tried it with a cacheable resource (PNG) and it does seem as if Cloudflare stripped it under certain circumstances. If you turn on development mode it gets passed through, but the moment the cache is involved it seems it is being stripped.

Maybe @cs-cf or @cloonan have more insight.

1 Like

@damian.szewczyk Another approach could be to set up a page rule which disables caching for the file in question. Once Cloudflare’s cache is not involved the header goes through.

@sandro thank you for your tips. Unluckily we’re not controlling our Cloudflare integration… Also we’d rather not skip Cloudflare cache and control each file independently…

@cs-cf @anon13938084 @ryan @harris @cloonan @Ricardo @zack @hasan
Any answer to this from Cloudflare team maybe? Is there a reason why “Cache-control: immutable” is not passed further? It could limit traffic from browsers, that implemented it (they will not try to revalidate the files marked as “immutable”).

Assuming they are in a common directory it should be sufficient to configure that directory.

I’ve set up my own Cloudflare integration and together with support found out how it should be configured.

Looks like by default max-age property is honored and passed by Cloudflare, but to have other fields from Cache-Control, Page Rule “Origin Cache Control” needs to be turned on


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