-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating global config on root domain doesn't affect subdomain urls once SW is installed #91
Comments
For the problem at hand, mix of cookie + "magic path" might work and make sense.
(but we should get correctness and caching first, global config is nice-to-have) |
another potential solution:
|
FYI we can't access cookies from firefox: https://caniuse.com/?search=cookie so we should probably do some type of fetch from root domain at |
I think maybe we can mark this as resolved for now because you can currently access config for a subdomain at https://specs-ipfs-tech.ipns.inbrowser.dev/#/ipfs-sw-config, and we also implode service-workers after 24 hours. |
So, to clarify how this config feature works for users:
|
Summary
Our current implementation of global configuration has a bug where updating the config on the root origin will not affect the configuration of a subdomain once the SW is installed.
This means that it's only possible to customise the configuration for a subdomain before the service worker is installed.
Reproduction
(Make sure you haven't loaded this CID prior. If you have, clear your browser storage for the origin)
Cause
The main cause for this seem to be the way that we pass config across subdomain origins, namely the
postMessage
call from the config iframe with the root url that is initially loaded on the subdomain.After the SW is installed, there's no way for config updates to be passed to the subdomain origin.
Potential solution
We may want to introduce a special path for loading the config page, that can be detected by the SW and handled as a special case. For example
/sw-config
would render the config page even when loaded on the subdomain origin with the SW installed. This isn't optimal, given that there's no way for us to communicate it to users. Additionally there's a low risk of path collision if the CID also has a path/sw-config
.Besides this, I can't think of any other way to allow changing configuration once the SW is installed.
Side note
The main reason for the message passing is to enable global configuration on the root domain that when updated, impacts every CID loaded via subdomains. However, this approach has a several disadvantages:
The text was updated successfully, but these errors were encountered: