pwa-module icon indicating copy to clipboard operation
pwa-module copied to clipboard

start_url does not respond with a 200 when offline

Open fahdaddi opened this issue 4 years ago • 3 comments

I'm using @nuxtjs/pwa "3.3.5" with nuxt "2.14.12". I ran the projecct with nuxt build; nuxt start (my build directory is: .build) and I'm using Nginx for local url redirection. My config looks like:

  icon: {
    iconFileName: "icon.png",
  },
  manifest: {
     name: "MyAppName",
     lang: "frFR",
     short_name: "AppName",
     start_url: "/?standalone=true",
     display: "standalone",
     background_color: "#f8f8f8",
     theme_color: "#f8f8f8",
     description: "My simple PWA app",
     icons: [],
  },
},

When I run a lighthouse test I get the following errors in pwa module: Capture d’écran 2021-02-02 à 09 57 35

Can anyone tell me what's the wrong with my config?

fahdaddi avatar Feb 02 '21 09:02 fahdaddi

Hi @fahdaddi. Can you please try by removing start_url option? (also i assume there is no workbox options in nuxt.config)

Update: I can see url scheme is http. Service workers only work with trusted origins (localhost and https)

pi0 avatar Feb 02 '21 10:02 pi0

Hey @pi0, for the workobxI found that all I need is default values? is there any vars that I should add ?

Update: I can see url scheme is http. Service workers only work with trusted origins (localhost and https)

I'll try to add a local SSL certificate to test it with https

fahdaddi avatar Feb 02 '21 10:02 fahdaddi

What I found is that self signed SSL is not going to be enough. Chrome will still complain that it is an insecure page and will not load sw.js file.

My solution is to run Chrome with the following flags from the command prompt on windows:

\'Program Files'\Google\Chrome\Application\chrome.exe --ignore-certificate-errors --unsafely-treat-insecure-origin-as-secure=https://localhost/

Hope this helps

avblink avatar Mar 09 '21 08:03 avblink