3 ms·
How does this interact with the browser's cache? For each potentially-cacheable request, the browser goes to its cache and looks up the entry by method and URI.
by niftich 10y ago
How does this interact with the browser's cache? For each potentially-cacheable request, the browser goes to its cache and looks up the entry by method and URI. When no hit is found, it forwards the request to the server, then depending on properties of the response, it may cache that response. At what point in the flow does the sw-delta-client code intercept the request? (Before the browser cache, or after the browser cache but before the web request?)
The sw-delta-client rewrites the URL, and the altered request is sent to the server. The server responds -- let's assume with a cacheable respone -- and the browser's cache gets updated.
Next time, we request the same URI but it's already cached and not stale, so it can be served right away from cache without having to go to the server. Does sw-delta-client intercept such a get-from-cache request? What if the cached entry is stale and needs to be revalidated by making a conditional GET to the server. Does it intercept revalidation requests?
Depending on some of these answers, the addition of query strings to the browser-perceived URI may influence whether browser caching is performed (properly, or at all). See: [1] http://stackoverflow.com/questions/24354119/ http://stackoverflow.com/questions/24354119/ [2] http://stackoverflow.com/questions/3131518/ http://stackoverflow.com/questions/3131518/ [3] https://support.cloudflare.com/hc/en-us/articles/200168256-What-are-CloudFlare-s-caching-levels- https://support.cloudflare.com/hc/en-us/articles/200168256-W... [4] http://stackoverflow.com/questions/23603023/ http://stackoverflow.com/questions/23603023/
- rictic 10y agoI haven't looked into the code yet, but the service worker has almost complete control over network requests and caching. It can calculate the correct response for a url (e.g. based on this delta encoding system), cache it, and use it in place of or alongside network requests in order to respond to a browser request.