Javascript files never get cached. 'cf-cache-status: MISS'


#1

Hello!

I am pretty sure I am just unclear on how cloudflare caching is suppose to work. Hoping someone can clarify / help me out.

I recently configured cloudflare on a domain of mine (about 2 days ago). For some reason all my javascript files that are being served from my domain never get cached. When I look at the response headers, I always see “cf-cache-status: MISS”

Actually here are the headers:

cache-control: public, max-age=14400
cf-cache-status: MISS
cf-ray: 4a466e7aed85c09a-ORF
content-encoding: br
content-type: application/javascript; charset=UTF-8
date: Tue, 05 Feb 2019 15:32:45 GMT
etag: W/"69ba-168b9773580"
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
expires: Tue, 05 Feb 2019 19:32:45 GMT
last-modified: Mon, 04 Feb 2019 17:03:44 GMT
server: cloudflare
status: 200
strict-transport-security: max-age=15552000; includeSubDomains
vary: Accept-Encoding
via: 1.1 vegur
x-content-type-options: nosniff
x-dns-prefetch-control: off
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block 

I even setup a page rule on my static path (/static/*) to cache everything but still no luck.

Like I said, I am probably missing something easy.

Thanks!


#2

Absent a URL to test I would assume it’s one of these:

  • If the Cache-Control header is set to “private”, “no-store”, “no-cache”, or “max-age=0”, or if there is a cookie in the response, then Cloudflare will not cache the resource.

#3

Sorry for not including a URL. Here is one: https://api.memberstack.io/static/memberstack.js

Thanks for your help!


#4

No worries, on the URI. Your origin is sending a max-age=0 header telling us not to cache it.

> Cache-Control: public, max-age=0

To test yourself:

curl -Ikv https://api.memberstack.io/static/memberstack.js --resolve api.memberstack.io:IP.address.of.your.cname.target


closed #5

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