w3c / ServiceWorker

Service Workers
https://w3c.github.io/ServiceWorker/
Other
3.63k stars 313 forks source link

Give servers opportunity to return 304 when re-requesting controllers. #56

Closed lucas42 closed 10 years ago

lucas42 commented 11 years ago

It seems that the intention is for controllers to be re-requested relatively frequently. If a controller is large but unchanging, this will cause a lot of unnecessary network traffic.

The advanced explainer says: "when the browser re-fetches the main script, it ignores HTTP heuristic caching and goes all the way to the network, requesting the controller directly from the server and bypassing HTTP caches"

I would like there to be an exception to this. The browser should look at the headers of the version in the HTTP cache and send if-modified-since / if-none-match where appropriate. If the server returns a 304 response, the version in the HTTP cache should remain (or whatever the browser normally does following a 304). The navigation controller logic should then be the same as if it had received a byte-for-byte identical copy.

jakearchibald commented 11 years ago

I agree. I think heuristic caching should be ignored, but explicit caching honoured. With the exception of far-future caches > 1 day, which should be floored to 1 day to avoid lock-in (perhaps with a warning in the console).

sicking commented 10 years ago

You can always return a 304, even if the UA hit the network due to the 24h-limit-policy.