|
| 1 | +--- |
| 2 | +title: "IPIP-0461: Ipfs-Path-Affinity on Gateways" |
| 3 | +date: 2024-02-16 |
| 4 | +ipip: proposal |
| 5 | +editors: |
| 6 | + - name: Marcin Rataj |
| 7 | + github: lidel |
| 8 | + url: https://lidel.org/ |
| 9 | + affiliation: |
| 10 | + name: IP Shipyard |
| 11 | + url: https://ipshipyard.com |
| 12 | +relatedIssues: |
| 13 | + - https://github.com/ipfs/kubo/issues/10251 |
| 14 | + - https://github.com/ipfs/kubo/issues/8676 |
| 15 | +order: 461 |
| 16 | +tags: ['ipips'] |
| 17 | +--- |
| 18 | + |
| 19 | +## Summary |
| 20 | + |
| 21 | +This IPIP adds gateway support for optional `Ipfs-Path-Affinity` HTTP request header. |
| 22 | + |
| 23 | +## Motivation |
| 24 | + |
| 25 | +Endpoints that implement :cite[trustless-gateway] may receive requests for a |
| 26 | +single block, or a CAR request sub-DAG of a biger tree. |
| 27 | + |
| 28 | +Not every CID is announced today, some providers limit announcements to |
| 29 | +top-level root CIDs due to time and cost. |
| 30 | + |
| 31 | +What this mean for ecosystem? It should adapt. Over time, both clients and |
| 32 | +servers should leverage the concept of "affinity". |
| 33 | + |
| 34 | +## Detailed design |
| 35 | + |
| 36 | +Introduce `Ipfs-Path-Affinity` HTTP request header to allow HTTP client to |
| 37 | +inform gateway about the context of block/CAR request. |
| 38 | + |
| 39 | +Client asking gateway for a block SHOULD provide a hint about the DAG the block |
| 40 | +belongs to, if such information is available. |
| 41 | + |
| 42 | +Gateway being unable to find providers for internal block should be |
| 43 | +able to leverage affinity information sent by client and use CIDs of parent |
| 44 | +path segments as additional content routing lookup hints. |
| 45 | + |
| 46 | +## Design rationale |
| 47 | + |
| 48 | +### User benefit |
| 49 | + |
| 50 | +When supported by both client and server: |
| 51 | + |
| 52 | +- Light clients are able to use trustless HTTP gateway endpoints more |
| 53 | + efficiently, resume downloads faster. |
| 54 | +- Gateway operators are able to leverage the hint and save resources related to |
| 55 | + provider lookup. |
| 56 | +- Content providers are able to implement smarter announcement mechanisms, |
| 57 | + without worrying that internal blocks are not announced. |
| 58 | + |
| 59 | +### Compatibility |
| 60 | + |
| 61 | +This is an optional HTTP header which makes it backward-compatible with |
| 62 | +existing ecosystem of HTTP clients and IPGS Gateways. |
| 63 | + |
| 64 | +### Security |
| 65 | + |
| 66 | +The client is in control when the affinity information is sent in the header, |
| 67 | +and implementation SHOULD allow end user to disable it in context where parent |
| 68 | +content path information is considered sensitive information. |
| 69 | + |
| 70 | +### Alternatives |
| 71 | + |
| 72 | +N/A |
| 73 | + |
| 74 | +## Test fixtures |
| 75 | + |
| 76 | +N/A |
| 77 | + |
| 78 | +### Copyright |
| 79 | + |
| 80 | +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
0 commit comments