Cloudlare showing cf-cache-status: DYNAMIC

Hi,

My images have started to return the header cf-cache-status: DYNAMIC and are no longer being cached.

I’ve applied a few rule chances, but this was hours ago.

Here is a link that should be showing as a hit: https://www.infinitesweeps.com/static/i/p/187673/

access-control-allow-origin: *
alt-svc: h3-23=":443"; ma=86400
cache-control: public, max-age=604800
cf-cache-status: DYNAMIC
cf-ray: 52804f476f13e80d-LAX
content-length: 111824
content-type: image/png
date: Sat, 19 Oct 2019 05:21:38 GMT
expect-ct: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct
expires: Sat, 26 Oct 2019 05:21:38 GMT
last-modified: Mon, 07 Oct 2019 14:22:39 GMT
server: cloudflare
status: 200
strict-transport-security: max-age=31536000; includeSubDomains
vary: User-Agent
x-content-type-options: nosniff
x-frame-options: sameorigin
x-robots-tag: noindex
x-xss-protection: 1; mode=block

Here is the direct link it’s coming from https://ww.infinitesweeps.com/static/i/p/187673/

Access-Control-Allow-Origin: *
Cache-Control: public, max-age=604800
Connection: keep-alive
Content-Length: 111824
Content-Type: image/png
Date: Sat, 19 Oct 2019 05:23:05 GMT
expires: Sat, 26 Oct 2019 05:23:05 GMT
Last-Modified: Mon, 07 Oct 2019 14:22:39 GMT
Server: nginx
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: User-Agent
X-Content-Type-Options: nosniff
X-FRAME-OPTIONS: sameorigin
X-Robots-Tag: noindex
X-XSS-Protection: 1; mode=block

The only page rules I have for /static/ are Mirage: On, Always Online: On, Cache Level: Ignore Query String

Can anybody please help?

I am sending the headers Cache-Control: public, max-age=604800

It’s like the rules are stuck with the old /static/i/ rules I had set. I tried purging the cache and that did not work. Links like this work correctly: https://www.infinitesweeps.com/static/i22/p/188127/makita.jpg

Cloudflare caches by file extension, not mime type. Your first link does not come with a file extension, so it would not be cached by default and you’d need a page rule for it to be cached.

1 Like

Hi,

That seems strange. What if the link was a html link ? domain.com/somethinghere/

Anyway, i’ve applied this rule

infinitesweeps.ca/static/i/

There are * and * at the front and beginning (they seem to be stripped off)

Browser Cache TTL: 16 days, Always Online: On, Security Level: Low, Cache Level: Ignore Query String, Edge Cache TTL: 14 days

About 10 minutes ago to the same domain, but the Canadian version for testing purposes first and it doesn’t seem to be helping either. Here is the link:

I hope that https://www.infinitesweeps.ca/static/i/p/187673/ starts loading

You need to properly format your rule, otherwise it is not clear what you configured.

Also, nothing in your rule indicates that it should cache it.

Which path do you exactly want to cache?

I want to cache all paths that for my images like

https://www.infinitesweeps.ca/static/i/p/187673/
https://www.infinitesweeps.ca/static/i/p/187672/
https://www.infinitesweeps.ca/static/i/p/187674/

The other links cache without any problem like https://www.infinitesweeps.ca/static/i22/p/187673/Win_porkrinds.jpg

In that case you will need a page rule

*infinitesweeps.ca/static/i/*

which defines a cache everything directive.

1 Like

Hi Sandro,

That is the exact rule I have in there, For some reason when I posted the comment, it stripped those out of here. Here is a screen shot of the rule in cloudflare:

No screenshot here.

The path is correct, but as I earlier said

Can you please tell me which rule I am missing to actually cache it? I thought that’s what the Browse Cache TTl and Edge Cache TTL are?

You need to change the cache level to “everything”.

1 Like

Won’t that cache links like https://www.infinitesweeps.ca/static/i/p/187673/?klsdjfklsdjlfksdjf

?

No overrides
Defaults to the caching level option you have in your Cloudflare performance settings for the domain.

Bypass cache
Will not cache at all

Standard / Aggressive caching
Caches all static content that has a query string in it

Ignore query string
Caches static content that has a query string and treats it as one file

Cache everything
Caches all file types on your site, including static content and HTML. Cloudflare Cache Everything will automatically respect any default cache headers set by the web server or CMS software like WordPress. See this article for more details on how headers affect this setting.

It will not ignore the query string, but you cant combine that. If you want these URLs cached as well you need to set it up as specified.

1 Like

That worked to “cache everything”.

So it sounds like if I don’t want to cache the query strings, I will need to turn these /i/33039/ links to /i/39393.jpg or something similar?

https://www.infinitesweeps.ca/static/i/p/187673/ is treated differently than https://www.infinitesweeps.ca/static/i/p/187673/?sdlkfjsdf

If there’s some rule I can add without having to redo all of these links, it would be awesome!

If you want to ignore the query string you will need to use - as I mentioned in my very first reply - an extension which is cached by default.

1 Like

Hi Sandro,

Thank you for all of your help. The answer is clear now and I will make the adjustments on my end.

Have a great weekend.

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