Super-Progressive-Web-Apps
Super-Progressive-Web-Apps copied to clipboard
Odd Behaviour When used Cross-Domain
Currently using wp-config.php to dynamically set the site domain name:
define('WP_SITEURL', $_SERVER['HTTP_HOST']);
define('WP_HOME', $_SERVER['HTTP_HOST']);
Now this is leading to some odd behaviour, the primary domain ayanajewellery.com vs. the sub-domain loaded us.ayanajewellery.com
Errors in Chrome console include:
Uncaught (in promise) TypeError: Failed to fetch
Uncaught (in promise) TypeError: Failed to update a ServiceWorker: Not found
Hello @koconder
The manifest and service worker are static files right now where the domain names are written into. You will find these in the root folder of the WordPress install.
The solution in these cases might happen if we can get #38 happen. Currently we are exploring the possibility.
@arunbasillal how is superpwa injected onto the page or loaded initially? As if browser is looking for a file i could easily do some magically rewrite rules on ngnix.
Here is the service worker registration script
https://github.com/SuperPWA/Super-Progressive-Web-Apps/blob/10cd1b7dcf675a8f63a169a6bcb5d29a8c82a31a/public/sw.php#L201-L216
The error is not because of an incorrect URL to the service worker. But because in the service worker: https://www.ayanajewellery.com/superpwa-sw.js the links are hard coded to https://www.ayanajewellery.com.
Thanks @arunbasillal - Could we leave the issue open till we have some update on #38 - Thanks
You got it :+1:
Hi @arunbasillal or others, could you please help me with the multi-domain setup as described above. Now that we have hooks like superpwa_sw_filename
Hows best to configure my site functions per domain?