Cache control #36
Replies: 3 comments 12 replies
-
So the behaviour Iam looking for is that the browser should load the cached webpage and revalidate with the etag after. Or if the esp is not in the network it should load the cached pages. Headers worth checking: must-revalidate, max-stale, max-age |
Beta Was this translation helpful? Give feedback.
-
You ask a very interesting question! Yes, we are currently using the no-cache option because we were not prepared to serve special needs. (We thought of ESP as a constantly powered, fault-tolerant system). As a bank web developer, I am aware of the principle of cache operation and its practical implementation. (Fortunately, there is no nginx proxy or CDN involved here, which would make the operation more complicated.) What I can suggest is that instead of the current no-cache, we work with an arbitrarily adjustable value, specified in seconds, and send it in the max-age header, e.g. 7200 (=2 hours). This can be overridden by the browser header (also called max-age), which indicates what value it accepts. We will send the smaller of the two. (The esp does not know for sure how much time it is, so we cannot generate a date (expires after 2024.12.30 00:00:00)). It will be valid for all pages, modern JS frameworks (webpack, babel) create JS files with new names anyway, so excessive caching of them will not be a problem. It's New Year's Eve, and after that I'm on leave due to medical intervention, but maybe I'll have the opportunity to help you with this. In summary: an optionally adjustable max-age value could be a good service. I plan to implement this. Happy New Year! |
Beta Was this translation helpful? Give feedback.
-
Work in progress: #37 |
Beta Was this translation helpful? Give feedback.
-
@BCsabaEngine Is caching possible somehow so the device can remember and load the cached page without the esp on the network?
Currently the caching works but the browser asks the esp for the etag and compares the cached etag with the one from the esp.
Until this communication is done, the browser does not load anything.
I wonder if i can bypass this so the browser loads the cached page anyway and asks for the etag later.
This all must happen without https so i can not use service workers
Beta Was this translation helpful? Give feedback.
All reactions