Service worker doesn't work due to User-Agent

I have some code that registers a service worker, however, the service worker isn’t able to be registered, in the console, it says that a 403 forbidden error was returned. After some debugging, I discovered that the website didn’t even receive the request for the service worker. Looking around in Glitch support, I think that the problem is that no user-agent is provided when registering a service worker. Is there a way around this?

I’m running React + Express with a service worker and it’s working without adding a specific user-agent.

I’ve used this and that tutorials on how to setup a PWA with service worker on Glitch.

1 Like