angularhtmliisservice-workeroffline-browsing

How can I make "Service Worker" work in local network?


I am building app with Angular 6 and I want this app to work offline and I am using Angular 6 with Service Worker and I want to host this app in local server with IIS but I do not have HTTPS cert.

What can I do to make service worker work without HTTPS? The app must work on Android, iPhone and Windows.


Solution

  • You cannot make it work without https. Having your site served over HTTPS is a requirement to enable service workers (apart from http://localhost and http://127.x.X.X).

    You definitely need a valid, trusted SSL certificate if you want it to run on all platforms on production. On windows, I think there are some Chrome options to bypass that, but this would still be only for testing

    Edit

    You can add certificates in IIS. It might not be a trusted one, but you can manually install and trust that certificate on your devices. This is a manual process valid only for development.

    As pointed by @Benjamin if all your users are on your same company network, then you can deploy that certificate on all machines (and phones) and it should work.