Open niels-garve opened 6 years ago
As a quick fix I made a fork where I removed the line (window.location.protocol === 'https:' || window.location.hostname === 'localhost' || window.location.hostname.indexOf('127.') === 0)
.
One could argue, if this could also be a solution: leave it up to the browsers whether to execute a Service Worker or not. What do you think?
Same thing. The option is super needed.
I have no insight to this issue, is there a PR regarding this anywhere, would someone submit one?
Hi,
I'm currently developing a website that runs on a virtual host on my local machine without HTTPS.
Google Chrome treats my virtual host as unsecure and won't install a Service Worker. This is totally fine due to their documentation:
But there's the possibility to open Chrome via Terminal and by using
--unsafely-treat-insecure-origin-as-secure=http://virtual-host.test
, which makes Chrome treat the provided origin as secure.Now, if I call
navigator.serviceWorker.register('/sw.js');
, Chrome installs the Service Worker on my local website with virtual host - while the offline-plugin won't. I did a little research and found thehasSW
-method:I see that you added the patterns from the Chrome docs - that's nice! Do you see any chance to set an option like
unsafelyTreatInsecureOriginAsSecure
? To be able to trust virtual hosts without installing locally self-signed certificates?Thank you so much!
Kind regards, Niels