yyx990803 / register-service-worker

A script to simplify service worker registration with hooks for common events.
MIT License
638 stars 58 forks source link

Check if application is visited via a private network #52

Closed raphaelbernhart closed 3 years ago

raphaelbernhart commented 3 years ago

The Problem: The Service Worker will be registered also if visited via a private network. So when e.g. a vue app is served and visited via http://10.0.0.1:8080 the service worker is registered.

The Solution: Check if the application is visited via a private network and process with the same logic as if visited via localhost

sodatea commented 3 years ago

A server deployed on a private network is still possible a production server. Therefore I don't think this logic should apply to those IP addresses.