mieweb / wikiGDrive

Wiki for Google Shared Drive
16 stars 5 forks source link

Cloudflare caching CSS and forcing Safari to keep it in memory #253

Closed horner closed 2 years ago

horner commented 2 years ago

See screenshot below. https://stackoverflow.com/questions/54326697/safari-caching-get-request-even-with-disabled-cache

Greg suggested he add the hash or /api/user?ts=18284 to the URL, but I wanted to make sure this was necessary before we did this.

horner commented 2 years ago

image

horner commented 2 years ago

@wreiske do you think we should add the url or fix cloudflare?

wreiske commented 2 years ago

@horner, IMO, best would be if you can change main.css to ${sha256('main.css')} like meteor. That way even when certain browsers ignore query strings, you'll always have the correct file.

Notice the CF-cache-status was MISS.... That wasn't cloudflare that had cached it at that point. It was safari respecting the cache-control. Maybe nginx or whatever is serving it added that? Cloudflare may have added the cache control, but would refresh the cache automatically after a certain time. It pulls from origin after a defined time to refresh the cache of any changes.

Adding a hash after, like main.css?h=shaOfMainCSS() doesn't always work because certain caches ignore query strings and only respect the file name.

horner commented 2 years ago

@wreiske thanks, I assigned this back to @ggodlewski