-
Notifications
You must be signed in to change notification settings - Fork 235
IPIP-280: App Conventions for HTTP Gateway Detection #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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 <[email protected]>
ipfs/specs#280 License: MIT Signed-off-by: Marcin Rataj <[email protected]>
* Using async-await * feat: support IPFS_GATEWAY env ipfs/specs#280 Signed-off-by: Marcin Rataj <[email protected]> Signed-off-by: Marcin Rataj <[email protected]> Co-authored-by: Marcin Rataj <[email protected]>
lidel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markg85 time to revisit this, now that we have IPIP process. some pointers below :)
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! |
lidel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
- fix "user-prefered" typo (3 occurrences) - clarify gateway file is ASCII (URLs are ASCII by definition)
- multiple lines are optional (MAY be supported) - if not supported, extra lines SHOULD be ignored - first line is always the primary URL
- browser detection requires separate IPIP (security concerns) - health checking left to implementers - stale file handling left to implementers
🚀 Build Preview on IPFS ready
|
- remove duplicate /etc/ipfs/gateway entries - properly handle XDG with explicit default path - group all OS-specific paths together - use consistent "system-wide" terminology
- update date to 2025-12-16 - update lidel affiliation to Shipyard - relax IPFS_GATEWAY interpretation from MUST to SHOULD
- URL must be without path (base URL only) - gateway must support trustless-gateway - gateway should support path-gateway for deserialized responses - gateway should support subdomain-gateway for Origin isolation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| and how IPFS gateway implementations can signal own endpoint. | |
| and how IPFS gateway implementations can signal their own endpoint. |
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.