Skip to content

Commit 8ecfec1

Browse files
committed
IPIP-0461: Ipfs-Path-Affinity on Gateways
1 parent 7b2bbeb commit 8ecfec1

File tree

3 files changed

+93
-0
lines changed

3 files changed

+93
-0
lines changed

src/http-gateways/path-gateway.md

+4
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ Gateway should refuse attempts to register a service worker for entire
195195
Requests to these paths with `Service-Worker: script` MUST be denied by
196196
returning HTTP 400 Bad Request error.
197197

198+
### `Ipfs-Path-Affinity` (request header)
199+
200+
Optional content routing hint, see [`Ipfs-Path-Affinity`](https://specs.ipfs.tech/http-gateways/trustless-gateway/#ipfs-path-affinity-request-header) in :cite[trustless-gateway].
201+
198202
## Request Query Parameters
199203

200204
All query parameters are optional.

src/http-gateways/trustless-gateway.md

+9
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ Below response types SHOULD be supported:
8888
A Gateway SHOULD return HTTP 400 Bad Request when running in strict trustless
8989
mode (no deserialized responses) and `Accept` header is missing.
9090

91+
### `Ipfs-Path-Affinity` (request header)
92+
93+
Optional content routing hint for the server. Indicates that the requested
94+
resource is a subset of a bigger DAG.
95+
96+
A Client SHOULD use it to send a relevant parent content path when:
97+
- fetching a big file block by block (`application/vnd.ipld.raw`)
98+
- parallelizing DAG download by fetching each branch sub-DAG as a CAR (`application/vnd.ipld.car`)
99+
91100
## Request Query Parameters
92101

93102
### :dfn[dag-scope] (request query parameter)

src/ipips/ipip-0461.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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

Comments
 (0)