nuxt-community / pwa-module

Zero config PWA solution for Nuxt.js
https://pwa.nuxtjs.org
MIT License
1.23k stars 171 forks source link

Issue registering service worker from outside localhost #496

Open darren-trottier opened 2 years ago

darren-trottier commented 2 years ago

PWA service workers will register when using http://localhost:3000

When using http://myipaddress:3000

Installability :

Page is not served from a secure origin No matching service worker detected. You may need to reload the page, or check that the scope of the service worker for the current page encloses the scope and start URL from the manifest.

darren-trottier commented 2 years ago

For anyone interested in a solution : Stack overflow topic

FenrirDrage commented 1 month ago

tried the "stack overflow" solution but i might be missing something 'cause it didn't work, still got the same issue

can someone help plz?

darren-trottier commented 1 month ago

Please provide more information regarding your particular problem and your particular setup. Also this topic is ~3years old, so it was for Nuxt2

FenrirDrage commented 1 month ago

got the same issue: PWA service workers will register when using http://localhost:3000/ and let the PWA be installed;

When using http://myipaddress:3000/

Installability : Page is not served from a secure origin

and when trying to do the steps on that link of stack overflow doesn't work, i might be missing something

darren-trottier commented 1 month ago

Is your local CA certificate is registered in the windows trust store ?

FenrirDrage commented 1 month ago

i created the certificate with "mkcert myip" so it should be trusted at least in my ip network right??

darren-trottier commented 1 month ago

You seem to have issue with this step :

Install and add MKcert to local root CA

mkcert -install

$ mkcert -install Created a new local CA 💥 The local CA is now installed in the system trust store! ⚡️ The local CA is now installed in the Firefox trust store (requires browser restart)! 🦊

FenrirDrage commented 1 month ago

i've manage to done that but chrome still says that the website is insecure and the certif invalid :(

i know i'm a bit dumb on this but i'm trying to learn and understand how this works ^^'

thanks for the help :)

darren-trottier commented 1 month ago

Could you try to add to your package.json in the script section :

"dev-ssl": nuxt dev --https --ssl-key [yourkeyname]-key.pem --ssl-cert [yourkeyname].pem"

Then try to run npm run dev-ssl

After that check, try to navigate with chrome to https://youripaddress:3000 (3000 beeing the port you are using).

And then check if your browser see your nuxt app SSL Secured.