Background
For anyone who has been wanting to host single-page applications (SPAs) in IPFS, it appears we’re getting closer to making this a reality.
Currently SPAs that include front end routing logic can’t be hosted in IPFS because they require rewrite rules on the server that essentially match all paths and return 200, allowing URLs to change in the browser but routing logic to be handled by the front end.
Current Work
The work so far has been on two fronts: specs and go-ipfs implementation (renamed to Kubo in case you missed that news).
Specs
@lidel recently merged the HTTP Gateways specs and will be reviewing the REDIRECTS_FILE spec shortly, which builds on top of the gateway specs.
The approach taken is a trimmed down version of the _redirects
file supported by Netlify and Cloudflare, allowing simple redirect / rewrite rules to be specified in a file at the root of your web app.
I recommend reading the RFC and spec for full details.
Implementation
An initial implementation for kubo can be found at feat(gateway): _redirects file support by justincjohnson · Pull Request #8890 · ipfs/kubo · GitHub. See this comment for instructions on how to build and test out locally.
If you run into any issues or have feedback, please reach out or add your feedback to the PRs above! Nothing is official yet, but it feels like we’re getting close enough to get excited.