Now that the http gateway has support for 404s as of 0.6, we started thinking about other HTTP type options tuned for hosting apps, rather than just data.
If you’re interested in this, please leave a comment here, or continue the discussion in the Fission forum, which this is a cross-post of.
In hosting applications on IPFS, there is an issue with Single Page Applications (SPAs). They have to use hash based routing when they are deployed to IPFS.
To better support SPAs and “clean” URLs, the server needs to know to redirect all paths for a route to a root index.js
or similar, aside from some static path.
We could add this by running a proxy in front of our IPFS gateway, and make this work with a flag just for apps hosted on Fission, but that defeats the purpose of making things work anywhere someone has IPFS running. Including developers running a go-ipfs node locally.
We could contribute a patch for this and work on getting it submitting into go-ipfs upstream, if there is interest. We did this for ipfs ignore already.
Much like the new 404 support in go-ipfs 0.6, there would need to be a file in the file tree that signals to turn on SPA-mode for a set of directories.
Perhaps rather than re-inventing things, since this is for HTTP, we can lean on existing patterns, like the .well-known
folder at the root of a website domain.
A variety of different frameworks for SPA mode use slightly different commands for defining routes, as well as different server / hosting providers.
Next Steps
Cross Post to IPFS forum and look for interested people to test, participate in spec, etc (DONE – this is the post!)
We would make an initial spec, reach out to different frameworks (Elm, React, Vue, Svelte, NextJS etc etc), and look for common practices in hosting providers (eg CNCF buildpacks for static sites, nginx config, vercel, netlify, etc etc).
Pool funds and identify go-lang developer who could create initial implementation and make PR to upstream
Work to get changes into upstream. Fission, others can run patched gateway (likely patch against 0.7 to make it easy for others to run)