-
Notifications
You must be signed in to change notification settings - Fork 320
Description
For navigate requests the sec-fetch-dest header is set to document. Once a service worker is introduced that simply forwards the request to the network, the sec-fetch-dest header changes to empty.
There are systems that rely on that header on server side to detect navigate requests and act accordingly. Shopify for example has some language/currency persistence logic that uses it.
Introducing a service worker that forwards requests (e.g. to cache responses for offline handling), breaks functionality.
I would argue that a navigate request from the browser should behave the same when proxied through a service worker. If this cannot be assumed by the developer, it gets very hard to implement service worker without potentially breaking functionality.
To have a reproducable example, here is a test website: https://dm-clone-optimized.app.baqend.com/fetch-dest/
It installs a service worker and when reloading you can see the sec-fetch-dest header being different depending on whether you bypass the service worker or not.