Network Weathermap doesn’t update correctly for clients of Cloudflare hosted domains

Issue - Cloudflare enables png file caching on the domains they host by default. weathermap.html is an interactive php overlay that calls weathermap.png as a static background. When clients connect to the weathermap.html file of a domain hosted by Cloudflare, they pull the updated html/php but they get a CDN cached weathermap.png background.

Issue validation - You can validate this behavior through the timestamps on the weathermap.html page not updating, updating to a previous version when the local browser cache is cleared and/or clients at different locations receiving pages with random timestamps at the same time (some off by over an hour).

Patch fix (Symptom) - Create a Cache Rule in the Cloudflare admin portal to bypass png file caching for the domain (Cloudflare → Caching → Cache Rules → Create Rule → Rule name, Field = file extension, Operator = equals, Value = png, Cache Eligibility = Bypass cache → Deploy.

You can probably limit the bypass to only png files in the Weathermap output directory or a single file if you need to but I don’t so I enabled the bypass for the entire domain.

Upstream fix (Root cause) - Add a ‘no cache’ directive to the weathermap.png header.

This was kind of a pain in the ass to figure out. I hope my misfortune can be someone else’s gain. :v:

1 Like

Thank you so much man!!