Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value of the Service-Worker request header #1605

Open
Nowasky opened this issue Oct 1, 2021 · 2 comments
Open

Value of the Service-Worker request header #1605

Nowasky opened this issue Oct 1, 2021 · 2 comments

Comments

@Nowasky
Copy link

Nowasky commented Oct 1, 2021

Is it up to browsers to decide what value will be included in the Service-Worker request header when an HTTP request is made to fetch a service worker's script resource?

I've noted that some browsers use script as the value for this header, but I couldn't find this information in the spec.

I'm unsure if administrators should be looking for the Service-Worker: script header specifically to detect the registration of a service worker.

@Nowasky
Copy link
Author

Nowasky commented Oct 1, 2021

Turns out it is in the spec. I don't know how I missed that.

Append `Service-Worker`/`script` to request’s header list.

https://w3c.github.io/ServiceWorker/#update-algorithm

Anyway, is it safe to assume that a registration request will always use script as the header's value? Or it's safer to check for the presence of the header regardless of its value?

@wanderview
Copy link
Member

We've thought about using a value of module if its a module service worker, but AFAIK no one is doing that yet. See:

#1582 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants