Thomas Broyer <t.br...@gmail.com>: Jan 04 11:12AM -0800
On Friday, January 3, 2025 at 6:51:34 AM UTC+1 leon.p...@gmail.com wrote:
Hi Craig,
there are 101 hacks to try and keep the browser from caching.
Problem is that it's a browser implementation on what to cache and what
not, and how the browser determines what to cache when seems subject to
change.
So for me I prefer to assume it doesn't work.
That's not my experience.
Note that refreshing a page is different from navigating to it (through a
link), or going back to it from the navigation history (might also use
bfcache), particularly when it comes to subresources.
Having said that; except for the last-modified flag my config is the same
as yours. I'll add it - thanks!
If it works, it works.
Fwiw,
- "Pragma: no-cache" never had a specified behavior in responses (it was
initially created for requests)
- Cache-Control is widespread (released in all browsers 11 years ago:
https://caniuse.com/mdn-http_headers_cache-control) so you can replace
Expires with a max-age directive.
- I would also use no-cache over no-store: the content of the nocache
files don't contain any user-sensitive information so it's ok to store them
as long as you revalidate with the server that they're still up-to-date.
For that, you need Last-Modified or ETag (preferred) response headers
though (you can just use the file's modification date, or derive an ETag
from its content). If your server doesn't send those, then I'd look for a
better implementation (or work around it by implementing it myself in a
filter as suggested here)
See also https://jakearchibald.com/2016/caching-best-practices/
and https://web.dev/articles/http-cache#flowchart
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to google-web-tool...@googlegroups.com.