Jump to conversation
Unresolved conversations (3)
@lidel lidel Aug 10, 2022
@justincjohnson thoughts on also supporting these niche redirect codes? The rationale is that the spec should state which codes are supported, and implementation should error on unsupported ones. By allowing all 301-308 variants here, we make it easier for people to move static website hosting to IPFS, while keeping dynamic backends that process POST still around. ```suggestion - `301` - Permanent Redirect (default) - `302` - Found (commonly used for Temporary Redirect) - `303` - See Other (replacing PUT and POST with GET) - `307` - Temporary Redirect (explicitly preserving body and HTTP method of original request) - `308` - Permanent Redirect (explicitly preserving body and HTTP method of original request) ```
Outdated
http-gateways/REDIRECTS_FILE.md
@justincjohnson @lidel
@lidel lidel Aug 10, 2022
```suggestion I believe the performance concerns are alleviated by not providing forced redirect support, and looking for `_redirects` only if the DAG is missing a requested path. Never the less, if a more generic metadata facility were to be introduced in the future, it may make sense to reconsider how redirect rules are specified. ```
Outdated
IPIP/0000-gateway-redirects.md
@lidel lidel Aug 10, 2022
```suggestion Provides general URL redirect and rewrite support, which enables three important features: 1. Developers will be able to host single-page applications in IPFS. 2. Same configuration file used for setting up pretty 404 pages. 3. The cost of switching hosting of an existing website to IPFS is lowered by making it possible to keep all legacy URLs working. ```
Outdated
IPIP/0000-gateway-redirects.md
Resolved conversations (17)
@thibmeu thibmeu Aug 19, 2022
## Comment A line starting with `#` is going to be considered a comment, and ignored at evaluation time. For example: ``` # Redirect home to index.html /home /index.html 301 ``` is functionally equivalent to ``` /home /index.html 301 ```
http-gateways/REDIRECTS_FILE.md
@justincjohnson @thibmeu
@thibmeu thibmeu Aug 11, 2022
Side comment: `kubo` supports [custom 404 pages](https://github.com/ipfs/kubo/commit/dfceafdbd3debca60959bdb9ecb28dd4c431c163) already. It does not appear to be in the HTTP gateway spec. Is this in the scope of this IPIP to provide backward compatibility to this unspecified behavior? cc @lidel
IPIP/0000-gateway-redirects.md
@justincjohnson
@thibmeu thibmeu Aug 11, 2022
consider a link either to the [RFC](https://www.rfc-editor.org/rfc/rfc2616#section-6.1.1) or [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status). I'd favor the later as it's more curated, but both are good starting point.
Outdated
IPIP/0000-gateway-redirects.md
@lidel lidel Aug 10, 2022
@justincjohnson mind adding a paragraph that explicitly states what end line sequences are supported? Will be important for people who want to support this in Rust/JS and can't use our Go libraries. I assume we support both `\n` and `\r\n` to make things easier for Windows folks?
http-gateways/REDIRECTS_FILE.md
@lidel lidel Aug 10, 2022
@justincjohnson Is this a typo? we already test named placeholders in the line above, and iiuc `:splat` is produced by a greedy wildcard, so to really test it we need: ```suggestion /splat/* /redirected-splat/:splat 301 ``` If this is a bug, you need to recreate CAR with fixtures in https://github.com/ipfs/kubo/pull/8890 and update CIDs in this document.
Outdated
http-gateways/REDIRECTS_FILE.md
@justincjohnson
@lidel lidel Aug 10, 2022
I think you meant 404 scenarios, right? (sometimes things may not resolve due to timeouts, better to be very clear what we mean here): ```suggestion All redirect logic MUST only be evaluated if the requested path is not present in the DAG. This means that any performance impact associated with checking for the existence of a Redirects File or evaluating redirect rules will only be incurred for non-existent paths. ```
Outdated
http-gateways/REDIRECTS_FILE.md
@lidel lidel Aug 10, 2022
```suggestion This can be used, for example, to enable URL rewriting for hosting a single-page application, to redirect invalid URLs to a pretty 404 page, or to avoid [link rot](https://en.wikipedia.org/wiki/Link_rot) when moving to IPFS-based website hosting. ```
Outdated
http-gateways/REDIRECTS_FILE.md
@lidel lidel Aug 10, 2022
@justincjohnson this CID does not seem to be reachable, mind pinning it somewhere? Also fine to `ipfs dag export` it and attach it as .zip to this comment thread, whatever works for you. (in the future we will have automation in this repo that backs up all CIDs mentioned in specs)
Outdated
IPIP/0000-gateway-redirects.md
@justincjohnson
@lidel lidel Aug 10, 2022
```suggestion The detailed specification is added in [`http-gateways/REDIRECTS_FILE.md`](../http-gateways/REDIRECTS_FILE.md). ```
Outdated
IPIP/0000-gateway-redirects.md
@lidel lidel Aug 10, 2022
```suggestion This IPIP proposes the introduction of redirect support for content hosted on Subdomain or DNSLink Gateways, configured via a `_redirects` file residing underneath the root CID of the web site. ```
Outdated
IPIP/0000-gateway-redirects.md
@lidel lidel Aug 10, 2022
SPA are not the only killer feature here, making it less expensive to move to IPFS is also a big win. ```suggestion Provide support for URL redirects and rewrites for web sites hosted on Subdomain or DNSLink Gateways, thus enabling support for [single-page applications (SPAs)](https://en.wikipedia.org/wiki/Single-page_application), and avoiding [link rot](https://en.wikipedia.org/wiki/Link_rot) when moving to IPFS-backed hosting. ```
Outdated
IPIP/0000-gateway-redirects.md
@lidel lidel Aug 10, 2022
This proposal is aligned with IPFS' long term goal of healing link rot on the Web. This IPIP bridges the gap between location-addressing and content-addressing tooling. Users who would like to migrate to IPFS ecosystem for website hosting will now have a built-in primitive for avoiding URL link rot. It may be obvious to some, but let's clearly state it here: ```suggestion Web sites often need to redirect from one URL to another, for example, to change the appearance of a URL, to change where content is located without breaking existing links (see [Cool URIs don't change](https://www.w3.org/Provider/Style/URI), [link rot](https://en.wikipedia.org/wiki/Link_rot)), to redirect invalid URLs to a pretty 404 page, or to enable URL rewriting. ```
Outdated
IPIP/0000-gateway-redirects.md
@lidel lidel Jun 24, 2022
Move to spec, and reference here.
Outdated
RFC/0000-gateway-redirects.md
@justincjohnson
@lidel lidel Jun 24, 2022
```suggestion The detailed specification is added in `http-gateways/REDIRECTS_FILE.md`. ```
Outdated
RFC/0000-gateway-redirects.md
@lidel lidel Jun 24, 2022
Move this section to `REDIRECTS_FILE.md` and only list CID that should be pinned in IPIP document.
Outdated
RFC/0000-gateway-redirects.md
@justincjohnson
@lidel lidel Jun 24, 2022
People using DNSLink/IPNS should be able to respond to takedown notices etc: ```suggestion - Useful for redirecting invalid URLs to a pretty 404 page. - `410` - Gone - `451` - Unavailable For Legal Reasons ```
http-gateways/REDIRECTS_FILE.md
@lidel lidel Jun 24, 2022
```suggestion Provide support for URL redirects and rewrites for web sites hosted on Subdomain or DNSLink Gateways, thus enabling support for [single-page applications (SPAs)](https://en.wikipedia.org/wiki/Single-page_application). ```
Outdated
RFC/0000-gateway-redirects.md