-
I am running my app in a Docker container and routing to it via a global a local nginx container and dnsmasq. In short, the app runs on the url, for example, When I run via a localhost, the service worker registers properly. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey, @gCardinal. There are multiple service worker options you can configure when calling worker.start({
serviceWorker: {
url: IS_DOCKER
? 'http://crew.shadowshifts.local.majisti.com/mockServiceWorker.js'
: '/mockServiceWorker.js'
}
}) Note that the worker script must be served from the same domain that your application where you intend to use MSW. |
Beta Was this translation helpful? Give feedback.
-
Service workers require the page to be secure (HTTPS) or the browser will refuse to register the service worker (even if Using HTTPS on local (via mkcert and a nginx reverse proxy) solve the issue for me. |
Beta Was this translation helpful? Give feedback.
Service workers require the page to be secure (HTTPS) or the browser will refuse to register the service worker (even if
msw
logs that the service worker is registered).Using HTTPS on local (via mkcert and a nginx reverse proxy) solve the issue for me.