You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/http-gateways/path-gateway.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -296,6 +296,8 @@ The request succeeded.
296
296
297
297
If the HTTP method was `GET`, then data is transmitted in the message body.
298
298
299
+
If the HTTP method was `HEAD`, then no body should be sent.
300
+
299
301
### `206` Partial Content
300
302
301
303
Partial Content: range request succeeded.
@@ -310,7 +312,9 @@ The new, canonical URL is returned in the [`Location`](#location-response-header
310
312
311
313
### `400` Bad Request
312
314
313
-
A generic client error returned when it is not possible to return a better one
315
+
A generic client error returned when it is not possible to return a better
316
+
one. For example, this can be used when the CID is malformed or its codec is
317
+
unsupported.
314
318
315
319
### `404` Not Found
316
320
@@ -641,9 +645,15 @@ Optional, present in certain response types:
641
645
642
646
### `Retry-After` (response header)
643
647
644
-
Gateway returns this header with error responses such as [`429 Too Many Requests`](#429-too-many-requests) or [`504 Gateway Timeout`](#504-gateway-timeout).
648
+
Gateway SHOULD return this header with error responses such as [`429 Too Many Requests`](#429-too-many-requests), [`504 Gateway Timeout`](#504-gateway-timeout) or `503` (server maintainance).
649
+
650
+
The "Retry-After" header indicates how long the user agent ought to wait before making a follow-up request. It uses the following syntax:
645
651
646
-
The "Retry-After" header indicates how long the user agent ought to wait before making a follow-up request.
Copy file name to clipboardExpand all lines: src/http-gateways/trustless-gateway.md
+36-42Lines changed: 36 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,24 +39,6 @@ The minimal implementation means:
39
39
40
40
A subset of "HTTP API" of :cite[path-gateway].
41
41
42
-
## `GET /ipfs/bafkqaaa`
43
-
44
-
`bafkqaaa` is the identity empty CID. This endpoint can be used to probe that that the endpoint corresponds to a trustless gateway.
45
-
46
-
For block requests (`?format=raw`), when supported, it must return `200 OK` and an empty body.
47
-
48
-
For CAR requests (`?format=car`), when supported, it must return `200 OK` and CAR file with root set to `bafkqaaa` and a single `bafkqaaa` block (which is empty).
49
-
50
-
We recommend supporting only this specific identity CID and not random identity CIDs.
51
-
52
-
## `HEAD /ipfs/bafkqaaa`
53
-
54
-
`bafkqaaa` is the identity empty CID. This endpoint can be used to probe that that the endpoint corresponds to a trustless gateway that correctly supports `HEAD` requests.
55
-
56
-
It must return `200 OK` in all cases.
57
-
58
-
We recommend supporting only this specific identity CID and not random identity CIDs.
59
-
60
42
## `GET /ipfs/{cid}[/{path}][?{params}]`
61
43
62
44
Downloads verifiable, content-addressed data for the specified **immutable** content path.
@@ -65,10 +47,14 @@ Optional `path` is permitted for requests that specify CAR format (`?format=car`
65
47
66
48
For block requests (`?format=raw` or `Accept: application/vnd.ipld.raw`), only `GET /ipfs/{cid}[?{params}]` is supported.
67
49
50
+
It is RECOMMENDED to additionally implement the [`GET` probe path](#dedicated-probe-paths).
51
+
68
52
## `HEAD /ipfs/{cid}[/{path}][?{params}]`
69
53
70
54
Same as GET, but does not return any payload.
71
55
56
+
It is RECOMMENDED to additionally implement the [`HEAD` probe path](#dedicated-probe-paths).
57
+
72
58
## `GET /ipns/{key}[?{params}]`
73
59
74
60
Downloads data at specified IPNS Key. Verifiable :cite[ipns-record] can be requested via `?format=ipns-record` or `Accept: application/vnd.ipfs.ipns-record`.
@@ -251,22 +237,7 @@ In case both are present in the request, the value from the [`Accept`](#accept-r
251
237
252
238
# HTTP Response
253
239
254
-
Below MUST be implemented **in addition** to "HTTP Response" of :cite[path-gateway].
255
-
256
-
## Status codes
257
-
258
-
Trustless gateways MUST return reasonable status codes.
259
-
260
-
*`200` for successful requests.
261
-
*`4xx` for client errors.
262
-
*`5xx` for server errors, server unavailability.
263
-
264
-
For example:
265
-
266
-
* A CID non retrievable from this gateway SHOULD return `404`
267
-
* A blocked CID SHOULD return `410` or `451`.
268
-
* A request with a malformed or unsupported CID SHOULD return `400`.
269
-
* No `5xx` status should be used for client errors, like requesting an unexistent path under a CID.
240
+
Below MUST be implemented **in addition** to "HTTP Response" of :cite[path-gateway], with special attention to the section relative to Response Status Codes.
270
241
271
242
## Response Headers
272
243
@@ -290,14 +261,6 @@ Same as in :cite[path-gateway], SHOULD be returned when Trustless Gateway
290
261
supports more than a single response format and the `format` query parameter is
291
262
missing or does not match well-known format from `Accept` header.
292
263
293
-
### `Retry-After` (response header)
294
-
295
-
In conjuction with status code `429` (for rate limiting) and `503` (maintenance), the `Retry-After` header can be used to signal how long the user agent should wait before making a follow-up request. This is a [standard response header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) with the following syntax:
296
-
297
-
```
298
-
Retry-After: <http-date>
299
-
Retry-After: <delay-seconds>
300
-
```
301
264
302
265
# Block Responses (application/vnd.ipld.raw)
303
266
@@ -480,3 +443,34 @@ returned as [application/vnd.ipfs.ipns-record](https://www.iana.org/assignments/
480
443
A Client MUST confirm the record signature match `libp2p-key` from the requested IPNS Name.
481
444
482
445
A Client MUST [perform additional record verification according to the IPNS specification](https://specs.ipfs.tech/ipns/ipns-record/#record-verification).
446
+
447
+
# Notes for implementers
448
+
449
+
## Dedicated Probe Paths
450
+
451
+
Trustless gateways SHOULD provide probing endpoints as described below.
452
+
453
+
### `GET /ipfs/bafkqaaa`
454
+
455
+
`bafkqaaa` is the identity empty CID. This endpoint can be used to probe that
456
+
that the endpoint corresponds to a trustless gateway.
457
+
458
+
For block requests (`?format=raw`), when supported, it must return `200 OK`
459
+
and an empty body.
460
+
461
+
For CAR requests (`?format=car`), when supported, it must return `200 OK` and
462
+
CAR file with root set to `bafkqaaa` and a single `bafkqaaa` block (which is
463
+
empty).
464
+
465
+
We recommend supporting only this specific identity CID and not random
466
+
identity CIDs.
467
+
468
+
### `HEAD /ipfs/bafkqaaa`
469
+
470
+
`bafkqaaa` is the identity empty CID. If this endpoint is enabled, the gateway
471
+
MUST support [`HEAD` requests](#head-ipfs-cid-path-params).
472
+
473
+
It must return `200 OK` in all cases.
474
+
475
+
We recommend supporting only this specific identity CID and not random
0 commit comments