Images caching blowing my mind

Hello everyone.
I’m struggling from months to solve a problem that I cannot manage to solve.

Here’s the deal:
my site (meteocaravino.altervista.org) is a Live weather website, and it has two images shot by a camera that need to be always up-to-date. In the site everything is working because I found a PHP workaround on tag, and I’m happy with that.
Problem is that third-party services asked me to include the image(s) on their websites, so they use the direct link to the image (https://meteocaravino.altervista.org/homepage/blocks/images/images/camera1.jpg).
And that’s the problem. Every time I open the image via direct URL, is not updated and I need to refresh the page in order to view it. I tried everything. I have a page rule that says “bypass cache”, I created and modified the .htaccess file… but nothing. Does anybody have suggestions?
Thanks !

Hi @meteocaravino,

The absence of the CF-Cache-Status header indicates the caching is being done at the origin server. There’s a cache-control header that sets a max age of 30 days. You need to investigate your server config, .htaccess (Apache) or equivalent, plugins etc to find out who’s setting this 30-day caching period. It’s likely a general setting for jpg images, that needs an exclusion at the origin server level for the images you need left uncached.

Thanks! I had an .htaccess on my root folder of the website with some cache-control stuff set. Now I cleared it, could you check again with your awesome instrument I saw? :smiley:

The “awesome instrument” you saw is called Developer Tools and is availabe on most browsers. On Windows > F12 or Ctrl-Shft-J. Then open the Network tab and click on the first item (your HTML page)

I’m still seeing the same cache-control header set to 30 days.

That’s good to know. Thanks. However, I don’t know if it’s some internal setting of altervista, but I can’t find anything else. I mean, now all htaccess are blank.
Do you know what I could/should write to perform that “exclusion” you mentioned on your first reply?

No, I don’t. I’d suggest you place this question at a more appropriate forum, such as https://stackoverflow.com, and provide more details about your system configuration to increase the chances of a good reply. (You may as well search that forum to see if a similar situation has already been answered.)

Ok. In the meanwhile I think I found the source of the problem. I’m working on it. Now the cache-control is still there but has an age of 1 second. Maybe this way will work :wink:

1 Like

Is your site under Cloudflare too? I didn’t know it will work with not standalone domain. I tried with Blogspot and Wordpress before, and they all have their own https certs.

Yes, it is. And I managed my settings in order to obtain what I wanted (no cache of images)!