I have a PWA developed in NodeJS and ReactJS. I have used gulp to generate service worker using sw-toolbox
. The service worker is working when I compile the app and visit localhost
URL but my app is using apache config and I have a DNS route defined for it in hosts.
File /etc/hosts:
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 localhost myapp.domain.com
I have overridden default apache config and enabled my own apache config for the app which looks like:
File /etc/apache2/sites-available/myapp.loc.conf:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName myapp.domain.com
ProxyPass /a http://microservice.domain.com/a
ProxyPassReverse /a http://microservice.domain.com/a
ErrorLog ${APACHE_LOG_DIR}/error2.log
CustomLog /tmp/access.log combined
Timeout 2400
ProxyTimeout 2400
</VirtualHost>
How to enable service worker locally on my website? I have tried many articles but could not find any answer