Preserve sec-fetch-dest for passed navigate requests
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 3.6k
- Forks
- 324
- Avg merge
- 14d 22h
- Merged PRs (30d)
- 1
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducible example at https://dm-clone-optimized.app.baqend.com/fetch-dest/ and compare the sec-fetch-dest header with and without the service worker. Read the Service Worker specification sections covering navigate requests and forwarding to the network; done means reaching a clarified or specified behavior that preserves the expected navigation semantics.
Written by the indexing model from the issue text.
Assessment
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100