Cache with no-cache headers

From my understanding, if I set no-cache header to static JS files in my origin server response, Cloudflare should cache these files but use caches only after successful revalidation with origin server.
However, after this “no-cache” header is set, all requests shows that “cf-cache-status: MISS”. I have nginx that add weak etag to all files.

I am not sure if I missed any other headers here. How should the setup be if I want Cloudflare to use cached static files after revalidate.

Here is an example response header that I got:

accept-ranges: bytes
cache-control: no-cache
cf-cache-status: MISS
cf-ray: 4e12d01facae21d8-EWR
content-encoding: gzip
content-length: 867
content-type: application/x-javascript
date: Mon, 03 Jun 2019 15:48:44 GMT
etag: W/"5cf53771-6e1"
expect-ct: max-age=604800, report-uri=""
last-modified: Mon, 03 Jun 2019 15:06:25 GMT
server: Cloudflare
status: 200
vary: Accept-Encoding

Hi @wyhyxzy,

Have you set up a Page Rule to handle the Edge and Browser cache TTLs for these files?

You could set the Edge Cache TTL value to the minimum and the Browser Cache TTL as you see fit.

If you are setting the Cache-Control header on your origin, you want to set its to:

Cache-Control: public, no-cache, proxy-revalidate
Cache-Control: public, s-maxage=0

More detail available here:


Hi Michael,

Thanks for your reply. I just realized that public directive is the one that allows any intermediate caches, like Cloudflare to cache a file.
I am a little bit confused about proxy-revalidate directive. From the description of the no-cache directive, it already specifies that response MUST NOT be used to satisfy a subsequent request without successful validation on the origin server. Why do we also need proxy-revalidate directive?


I’m guessing, but with only “no-cache” you have not told Cloudflare to cache the file at all, so MISS. no-cache applies to the Client cache as well, and you explicitly want CF to revalidate, and the client to not cache.

I read the description of must-revalidate and proxy-revalidate in RFC again. Seems, must-revalidate and proxy-revalidate only works for stale assets. While no-cache directive works for the ones that doesn’t have a max-age specified.
I think public and no-cache is enough for my case.
Thanks for your help!

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