Open kevincox opened 1 year ago
For the interested. There is currently a whitelist of old WebUI URLs to avoid old links breaking without having IPFS proxy arbitrary content:
https://github.com/ipfs/kubo/blob/ced4be8c130919af47fb24dc98d86b699b118c18/core/corehttp/webui.go
Sounds sensible :+1: but this has to be done with the same caching strategy we have for /ipns/
namespace.
:point_right: We really don't want to blindly bind this to /ipfs/cid
behind the scenes, as that would return /webui
with Cache-Control | public, max-age=29030400, immutable
and that will be cached forever and will break users big time :eyes:
One way to do this safely is to redirect to /ipns/webui
and have webui
statically resolve to hardcoded path (fake dnslink).
This way, webui will be sharing all the already existing logic for /ipns/
namespace, and no additional code and testing will be necessary.
If anyone has time to submit a PR that does HTTP caching correctly, I'd be happy to review/accept.
One small nit: I don't really like /ipns/webui
as it is a "fake" IPNS link. Probably it would be better to mirror true IPNS like /ipns/webui.ipfs.io
(even if the resolution is pinned at build time or something) or use a separate URL like /webui
.
Checklist
Description
Is your feature request related to a problem? Please describe. Right now the web interface is served from the node. There is an
/webui/
endpoint but it just redirects to the CID such as/ipfs/bafybeic4gops3d3lyrisqku37uio33nvt6fqxvkxihrwlqsuvf76yln4fm/
. This is quite annoying as it means that pages don't have stable URLs. I would like to be able to use bookmarks and my browser's history to pages such as specific directories in my MFS repo. Right now the link will pin an older version and navigating using the/webui/
path will pollute my history with different but equivalent URLs.As the W3C says Cool URIs don't change.
Describe the solution you'd like Instead of redirecting the webui would just serve the page from the
/webui/
endpoint.This may cause some minor issues with caching as the webui uses relative URLs. However this is probably fine since a brief look shows that they contain content hashes in the filenames anyways so they should still be cachable forever (as long as the index page has a reasonable timeout). In fact this may improve caching as assets that are unchanged between versions will keep the same URL.
An alternative solution to caching would be to still load the assets from
/ipfs/{cid}/...
but that would require updating the webui itself which may be more work for no gain.