Service Worker
Service-Worker request header is included in fetches for a service worker’s script resource. This header helps administrators log service worker script requests for monitoring purposes.
Note: The header is only for informational purposes and does not affect the actual request.
Syntax
Service-Worker: script
Directives
script
A value indicating that this is a script. This is the only allowed directive for this header.
How to Modify Header using Requestly
Requestly is a powerful Chrome extension that allows you to modify HTTP headers, including the Service-Worker header. This can be very useful for developers who want to test or debug how their web applications behave when service workers are enabled or disabled. Steps to Modify the Service-Worker Header:
- Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
- Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
- Add a new header modification:
- Under “Action”, select “Add” or “Override”.
- In the “Header Name” field, enter Service-Worker.
- In the “Header Value” field, enter your desired value (e.g., script or none).
- Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-website.com/\*).
- Save the rule.
Once configured, Requestly will modify the Service-Worker header for all matching requests, enabling you to control and test how your site handles service workers in different scenarios.
Set headers visually: intercept and modify HTTP headers without touching your code using Requestly.
Download Free →