IPIP-280: App Conventions for HTTP Gateway Detection - #280
Conversation
This should help other application developers to have an idea of what's needed to add IPFS support to their application.
|
Ping. What's still required for this document to get merged? Don't confuse this with the document the add the |
|
Hi @markg85, two quick comments on this from some related discussion in ipfs/in-web-browsers#197:
|
ipfs/specs#280 License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
ipfs/specs#280 License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
* Using async-await * feat: support IPFS_GATEWAY env ipfs/specs#280 Signed-off-by: Marcin Rataj <lidel@lidel.org> Signed-off-by: Marcin Rataj <lidel@lidel.org> Co-authored-by: Marcin Rataj <lidel@lidel.org>
I get the mindset here and it would help a lot! Not just with apps using IPFS but also with js libraries (think for example video.js) where we'd like to have IPFS integration in at some point in time too. Having a But.. how? When IPFS Companion is used, injecting a variable is doable. The downside is another point of metric collection to profile people. And for that reason alone i don't think this variable would be accepted. Even if we would all like it and add it to the spec, the browser security minded folks would probably have an issue with it. @lidel do you have an opinion on this?
Usually i'd say "yes, go for it!" but in this case, waiting is probably the smarter move. If you'd go for that you'd have a spec wip branch on top of my wip branch. That's a little too much wip. Wait till this spec lands (it's mostly there) before you consider making a spec on top of this one. |
Sweet! |
Co-authored-by: Marcin Rataj <lidel@lidel.org>
lidel
left a comment
There was a problem hiding this comment.
Quick feedback:
- make this Kubo-agnostic
- document configuration location on MS Windows and macOS
- ensure manually added entries are not removed by starting/stopping local node
- allow for multiple local gateways to co-exist, and not "steal" traffic
There was a problem hiding this comment.
Thanks for ping. This spec documents something that's already working in the wild (curl, ffmpeg, kubo's $IPFS_PATH/gateway), which is valuable, and ratification feels like a formality:
| Project | Reads IPFS_GATEWAY |
Reads gateway file |
Writes gateway file |
|---|---|---|---|
| Kubo | - | - | Yes (since v0.15) |
| curl | Yes | Yes (~/.ipfs/gateway) |
- |
| ffmpeg | Yes | Yes ($IPFS_PATH/gateway or ~/.ipfs/gateway) |
- |
I've pushed some cosmetic changes, but would like second set of eyes on this before we merge (@markg85 / @2color ?)
IIUC this spec documents existing behavior that's already shipping in curl and ffmpeg, and having it written down helps future implementers (especially when LLMs are reading and likely prioritizing specification documents for best-practices when code generating).
|
Hi @lidel, Thank you for your updates, that's much appreciated! I just went over the text and it looks oke to me. I can't give an approve as I'm the author (not allowed in the ui) but consider this my stamp of approval ✔️ |
|
Thank you. Let's keep this open over holidays in case someone wants to provide late feedback. Ok to merge in January when we are back from a break. |
|
I'll give this a more thorough review. I should also mention that this IPIP is already implemented in https://github.com/fsspec/ipfsspec. |
|
|
||
| ## Introduction | ||
|
|
||
| This document defines conventions for how applications can identify available |
There was a problem hiding this comment.
| This document defines conventions for how applications can identify available | |
| This document defines conventions for how applications can identify an available |
| ## Introduction | ||
|
|
||
| This document defines conventions for how applications can identify available | ||
| IPFS gateway, and how IPFS gateway implementations can signal own endpoint to |
There was a problem hiding this comment.
| IPFS gateway, and how IPFS gateway implementations can signal own endpoint to | |
| IPFS Gateway, and how IPFS Gateway implementations can signal their own endpoint to |
| Applications SHOULD evaluate these hints in order and stop on the first match: | ||
|
|
||
| 1. Check if a valid `IPFS_GATEWAY` environment variable is set | ||
| 2. Check if a valid `gateway` file is present at one of well-known filesystem paths |
There was a problem hiding this comment.
| 2. Check if a valid `gateway` file is present at one of well-known filesystem paths | |
| 2. Check if a valid `gateway` file is present at one of the well-known filesystem paths |
|
|
||
| ### `IPFS_GATEWAY` Environment Variable | ||
|
|
||
| When `IPFS_GATEWAY` environment variable is set, the value SHOULD be interpreted |
There was a problem hiding this comment.
| When `IPFS_GATEWAY` environment variable is set, the value SHOULD be interpreted | |
| When the `IPFS_GATEWAY` environment variable is set, the value SHOULD be interpreted |
| ### `IPFS_GATEWAY` Environment Variable | ||
|
|
||
| When `IPFS_GATEWAY` environment variable is set, the value SHOULD be interpreted | ||
| as URL of IPFS Gateway application to use. |
There was a problem hiding this comment.
| as URL of IPFS Gateway application to use. | |
| as the URL of the IPFS Gateway to use. |
| title: Detecting User-Preferred IPFS Gateway | ||
| description: > | ||
| Specification of the rules and standards for detecting and identifying | ||
| user-preferred IPFS gateways within applications, enabling seamless |
There was a problem hiding this comment.
| user-preferred IPFS gateways within applications, enabling seamless | |
| user-preferred IPFS Gateways within applications, enabling seamless |
|
|
||
| ## Specification | ||
|
|
||
| There are two ways of hinting user-preferred gateway URL: |
There was a problem hiding this comment.
| There are two ways of hinting user-preferred gateway URL: | |
| There are two ways of hinting the user-preferred gateway URL: |
|
|
||
| ### Security | ||
|
|
||
| Applications that integrate IPFS support via HTTP gateway: |
There was a problem hiding this comment.
| Applications that integrate IPFS support via HTTP gateway: | |
| Applications that integrate IPFS support via HTTP gateways: |
|
One tricky thing with this proposal is that We should probably just make this clear in the spec. |
|
|
||
| ## Summary | ||
|
|
||
| This IPIP creates conventions for how applications can identify available IPFS gateway, |
There was a problem hiding this comment.
| This IPIP creates conventions for how applications can identify available IPFS gateway, | |
| This IPIP creates conventions for how applications can identify an available IPFS gateway, |
| ## Summary | ||
|
|
||
| This IPIP creates conventions for how applications can identify available IPFS gateway, | ||
| and how IPFS gateway implementations can signal own endpoint. |
There was a problem hiding this comment.
| and how IPFS gateway implementations can signal own endpoint. | |
| and how IPFS gateway implementations can signal their own endpoint. |
|
@lidel When you get a chance, can you please give this another review. |
Review suggestions from ipfs#280: missing articles, plural agreement, and IPFS Gateway capitalization in the spec and IPIP intros. Also credit the reviewer via thanks: frontmatter, bump date:, and collapse double blank lines flagged by markdownlint MD012. Co-authored-by: Daniel Norman <1992255+2color@users.noreply.github.com>
Close gaps found by reviewing curl, ffmpeg, Kubo, and ipfsspec sources against the spec text. - gateway-detection: IPFS_GATEWAY holds a single URL and yields to explicit per-invocation input; invalid and missing hints defined; $HOME/.ipfs documented as the default IPFS_PATH location; gateway file URL format tightened (no path, query, or fragment); security requirements reformatted as a list and public-gateway fallback relaxed to SHOULD NOT; plainer description - ipip-0280: curl support dated to 8.4.0 (2023); version bounds made inclusive; ffmpeg precedence and IPFS_PATH trailing-slash quirk documented, dweb.link fallback removal linked; curl first-line parsing since 8.5.0 noted; ipfsspec added to compatibility; typos
Add everyone who left feedback on ipfs#280 to thanks: and drop the homepage URL from the editor entry.
Spec becomes 'User-Preferred Gateway Detection' (noun phrase like sibling specs, keeps the user-agency angle); IPIP becomes 'IPIP-0280: App Conventions for Gateway Detection' (the PR title minus the HTTP wording that mismatched the spec's IPFS Gateway terminology).
This should help other application developers to have an idea of what's needed to add IPFS support to their application.
cc @Stebalien and @autonome Conversations with mainly you two have led to this spec being implemented as is written here in ffmpeg.