0

As above, is there an easy way to allow service workers for local development when served via http on a local network when using chrome & dev tools?

Is there a port # to serve on? Did I miss an option in Dev Tools to allow a domain?

I am aware of this answer from a Google Dev suggesting it isn't possible without hacking chrome, but that answer was given back in 2015 and a lot has happened with PWA/sw.js since then - so I am hoping I'll get lucky!

Thanks for any assistance in advance.

TBB
  • 1,207
  • 1
  • 14
  • 25

2 Answers2

2

One of the easiest way is to install Web Server for Chrome Extension and select the work folder inside the App and start web server in seconds to test Service Worker.

Rama Adaikkalam
  • 665
  • 1
  • 7
  • 14
  • Thanks for trying (+1). This would work where dev output urls are relative, but mine are absolute urls with the lan address hard coded - so I'd only get access to root the index.html. It would be easier for me to set dev output to serve on localhost - which I am thinking I will just do. – TBB Apr 03 '18 at 12:10
0

No change. For service workers to work, the LAN needs a valid SSL certificate.

Workarounds appears to be:

  1. serve dev on localhost, if you can;
  2. as per the link in my question, launch chrome from terminal with unsafe flags and temporary directory (also see this hopefully available link showing an example command); or
  3. if your dev build output has relative uris, launch another server on your computer (e.g. web server for chrome) with the relevant LAN dir as source.

I simply went localhost.

If a Chrome Dev sees this, it might be a handy feature to add an option in DevTools > Application to temporarily permit an unsafe domain (like the flags option).

Have fun people.

TBB
  • 1,207
  • 1
  • 14
  • 25