How long do images stay in the CDN once the origin has been removed?

I requested some images be removed on a website that uses Cloudlfare. They were removed, but when mobile users click on them they still appear on a CDN url. Some were CDN1, others CDN2, 3, 4 etc. I a managed to have them all taken down except CDN4, and the host won’t take these down for some reason.

My question is will these expire? And if so, what is the maximum ttl for the CDN images?

Welcome to the Cloudflare Community. :logodrop:

While items are evicted from the Cloudflare cache as necessary, you would be better off to purge your Cloudflare cache after you have modified your origin site if you want the changes to be reflected immediately.

1 Like

Thanks for the response. It’s not my website, so I don’t have that option. I’m just wondering if the images will remain there for ever, or if they’ll eventually go. As I understand, each CDN image has a TTL. But is it possible a CDN image can remain online for ever (even if the source image has been removed)? The source images were taken down about 6 months ago.

1 Like

Since it is not your server, how do you know the file was actually removed? Cloudflare doesn’t normally keep an unavailable item in the cache that long.

There isn’t much assistance the Community can offer you for a site that you don’t control. You will need to ask the site operator for support.

I suppose I don’t know for sure. The main image links were removed, the images have vanished from the website, and the only exception is when someone clicks the blank image on mobile, the CDN4 image appears. To me that suggests the cache just hasn’t been updated. The site owner is unresponsive, despite having deleted the other images.

You could always take a look at the relevant headers returned when requesting the file to see what they indicate. Many here would use curl for that. You can use the developer tools in your web browser.

Thanks, I’ll try that. What should I look out for? Should I be looking at the expired urls or the active urls for the CDNs?

You may find the cf-cache-status header of interest. It will return a value of HIT or MISS. Note that it is very likely to see the former on a subsequent request that initially returned the latter since the initial request could cause the file to be cached by Cloudflare, if eligible. The cache-control and expires headers may also interest you.

Cloudflare doesn’t use special CDN names by default. It is a caching reverse proxy. A site operator could certainly structure their content in a manner where they only used particular domains with Cloudflare, but you would need to make that determination yourself by analyzing the page structure.

1 Like

CDN

Hmm, the most I can find is this. (Yes, it’s from a p*rn website) Any idea what this could mean?

DNS returns Cloudflare IPs on that hostname, so you know that it routes through the Cloudflare proxy. You need to view the relevant URL in the Network tab of the developer tools to see the headers included with the response.


I see that it says ‘no cache’, although I can’t find the other headers you mention. Thanks for helping with this by the way

1 Like

Also, max-age=15768000

I believe this is the ttl? So it may yet expire. That equates to half a year, and so far it has been just a little less than half a year.

Actually, the max is for the Strict-Transport-Security for the httpapi. The onicon.png, which I think is the image itself, doesn’t specify a max age.

It’s a little different than a TTL as there is no guarantee that it will be cached for the duration indicated. It is a maximum value that indicates that it should not be cached in excess of the specified timeframe.

It is not. The headers for the asset selected in your screenshot show the path of a file that is part of a browser extension installed on your computer and not a resource being loaded from Cloudflare.

Okay, thanks. Sorry, I realised that the image was from a browser extension I have, so that can be ignored.

There is no indication of cache ttl anywhere from what I can see, only the strict-transport-security, the max age for which has not yet elapsed. As I say, the original images have been removed, and only the CDNs remain - I don’t imagine the source images are being stored anywhere else, behind the scenes. But then I may be wrong.

You need to explicitly view the headers returned with the image asset that you are concerned with. If it is being served by Cloudflare, there is a very good chance that it is still present on the origin server of the site operator as that is where Cloudflare fetches content that is not found in the cache.

Okay so I entered the url into a cache reader and it came back with the following:

Cache Headers In Response

  • Date: Mon, 11 Mar 2024 17:07:44 GMT
  • ETag: W/"62836cf8-86ce4"
  • Cache-Control: max-age=315360000
  • Last-Modified: Tue, 17 May 2022 09:38:00 GMT
  • Expires: Thu, 31 Dec 2037 23:55:55 GMT

So if I’m reading this correctly, is has been cached and will remain in the cache for ten years?

This is the header that tells you whether the resource is cached by Cloudflare or not. All the other headers do not matter.

1 Like

The cache header reads ‘hit’.

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