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
+53-15
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: >
4
4
The comprehensive low-level HTTP Gateway enables the integration of IPFS
5
5
resources into the HTTP stack through /ipfs and /ipns namespaces, supporting
6
6
both deserialized and verifiable response types.
7
-
date: 2023-03-30
7
+
date: 2024-04-17
8
8
maturity: reliable
9
9
editors:
10
10
- name: Marcin Rataj
@@ -242,13 +242,35 @@ These are the equivalents:
242
242
When both `Accept` HTTP header and `format` query parameter are present,
243
243
`Accept` SHOULD take precedence.
244
244
245
+
A Client SHOULD include the `format` query parameter in the request URL, in
246
+
addition to the `Accept` header. This provides the best interoperability and
247
+
ensures consistent HTTP cache behavior across various gateway implementations.
248
+
249
+
A Gateway SHOULD include the
250
+
[`Content-Location`](#content-location-response-header) header in the response when:
251
+
- the request contains an `Accept` header specifying a well-known response
252
+
format, but the URL does not include the `format` query parameter
253
+
- the `format` parameter is present, but does not match the format from `Accept`
254
+
245
255
### `dag-scope` (request query parameter)
246
256
247
-
Only used on CAR requests, same as :ref[dag-scope] from :cite[trustless-gateway].
257
+
Optional, can be used to limit the scope of verifiable DAG requests such as CAR, same as :ref[dag-scope] from :cite[trustless-gateway].
248
258
249
259
### `entity-bytes` (request query parameter)
250
260
251
-
Only used on CAR requests, same as :ref[entity-bytes] from :cite[trustless-gateway].
261
+
Optional, can be used to limit the scope of verifiable DAG requests such as CAR, same as :ref[entity-bytes] from :cite[trustless-gateway].
262
+
263
+
### `car-version` (request query parameter)
264
+
265
+
Optional, specific to CAR requests, same as :ref[car-version] from :cite[trustless-gateway].
266
+
267
+
### `car-order` (request query parameter)
268
+
269
+
Optional, specific to CAR requests, same as :ref[car-order] from :cite[trustless-gateway].
270
+
271
+
### `car-dups` (request query parameter)
272
+
273
+
Optional, specific to CAR requests, same as :ref[car-dups] from :cite[trustless-gateway].
252
274
253
275
# HTTP Response
254
276
@@ -486,12 +508,35 @@ To illustrate, `?filename=testтест.pdf` should produce:
486
508
not attempt to render raw bytes. CID and `.bin` file extension should be used
487
509
if a custom `filename` was not provided with the request.
488
510
511
+
### `Content-Location` (response header)
512
+
513
+
Returned when a non-default content format has been negotiated with the
514
+
[`Accept` header](#accept-request-header) but `format` was missing from the URL.
515
+
516
+
The value of this field SHOULD include
517
+
the URL of the resource with the `format` query parameter included, so that
518
+
generic HTTP caches can store deserialized, CAR, and block responses separately.
519
+
520
+
:::note
521
+
522
+
For example, a request to `/ipfs/{cid}` with `Accept: application/vnd.ipld.raw`
523
+
SHOULD return a `Content-Location: /ipfs/{cid}?format=raw` header in order for
524
+
block response to be cached separately from deserialized one.
525
+
526
+
:::
527
+
489
528
### `Content-Length` (response header)
490
529
491
530
Represents the length of returned HTTP payload.
492
531
532
+
:::warning
533
+
534
+
<!-- TODO https://github.com/ipfs/specs/issues/461 -->
535
+
493
536
NOTE: the value may differ from the real size of requested data if compression or chunked `Transfer-Encoding` are used.
494
-
<!-- TODO (https://github.com/ipfs/in-web-browsers/issues/194) IPFS clients looking for UnixFS file size should use value from `X-Ipfs-DataSize` instead. -->
537
+
See [ipfs/specs#461](https://github.com/ipfs/specs/issues/461).
538
+
539
+
:::
495
540
496
541
### `Content-Range` (response header)
497
542
@@ -513,8 +558,6 @@ deterministic.
513
558
Returned only when response status code is [`301` Moved Permanently](#301-moved-permanently).
514
559
The value informs the HTTP client about new URL for requested resource.
515
560
516
-
This header is more widely used in [SUBDOMAIN_GATEWAY.md](./SUBDOMAIN_GATEWAY.md#location-response-header).
517
-
518
561
#### Use in directory URL normalization
519
562
520
563
Gateway MUST return a redirect when a valid UnixFS directory was requested
@@ -530,6 +573,10 @@ It also ensures the same behavior on path gateways (`https://example.com/ipfs/ci
530
573
and origin-isolated HTTP contexts `https://cid.ipfs.dweb.link`
531
574
or non-HTTP URLs like `ipfs://cid`, where empty path component is implicit `/`.
532
575
576
+
#### Use in interop with Subdomain Gateway
577
+
578
+
See [`Location` section](https://specs.ipfs.tech/http-gateways/subdomain-gateway/#location-response-header) of :cite[subdomain-gateway].
579
+
533
580
### `X-Ipfs-Path` (response header)
534
581
535
582
Used for HTTP caching and indicating the IPFS address of the data.
@@ -567,15 +614,6 @@ NOTE: while the first CID will change every time any article is changed,
567
614
the last root (responsible for specific article or a subdirectory) may not
568
615
change at all, allowing for smarter caching beyond what standard Etag offers.
Copy file name to clipboardexpand all lines: src/http-gateways/trustless-gateway.md
+45-4
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: >
4
4
The minimal subset of HTTP Gateway response types facilitates data retrieval
5
5
via CID and ensures integrity verification, all while eliminating the need to
6
6
trust the gateway itself.
7
-
date: 2023-06-20
7
+
date: 2024-04-17
8
8
maturity: reliable
9
9
editors:
10
10
- name: Marcin Rataj
@@ -90,7 +90,18 @@ mode (no deserialized responses) and `Accept` header is missing.
90
90
91
91
## Request Query Parameters
92
92
93
-
### :dfn[dag-scope] (request query parameter)
93
+
### :dfn[`format`] (request query parameter)
94
+
95
+
Same as [`format`](https://specs.ipfs.tech/http-gateways/path-gateway/#format-request-query-parameter) in :cite[path-gateway], but with limited number of supported response types:
The optional `entity-bytes=from:to` parameter is available only for CAR
117
128
requests.
@@ -183,6 +194,30 @@ returned:
183
194
returned to the client, the HTTP status code has already been sent to the
184
195
client.
185
196
197
+
### :dfn[`car-version`] (request query parameter)
198
+
199
+
Optional, only used on CAR requests.
200
+
201
+
Serves same purpose as [CAR `version` content type parameter](#car-version-content-type-parameter).
202
+
203
+
In case both are present in the request, the value from the [`Accept`](#accept-request-header) HTTP Header has priority and a matching [`Content-Location`](#content-location-response-header) SHOULD be returned with the response.
204
+
205
+
### :dfn[`car-order`] (request query parameter)
206
+
207
+
Optional, only used on CAR requests.
208
+
209
+
Serves same purpose as [CAR `order` content type parameter](#car-order-content-type-parameter).
210
+
211
+
In case both are present in the request, the value from the [`Accept`](#accept-request-header) HTTP Header has priority and a matching [`Content-Location`](#content-location-response-header) SHOULD be returned with the response.
212
+
213
+
### :dfn[`car-dups`] (request query parameter)
214
+
215
+
Optional, only used on CAR requests.
216
+
217
+
Serves same purpose as [CAR `dups` content type parameter](#car-dups-content-type-parameter).
218
+
219
+
In case both are present in the request, the value from the [`Accept`](#accept-request-header) HTTP Header has priority and a matching [`Content-Location`](#content-location-response-header) SHOULD be returned with the response.
220
+
186
221
# HTTP Response
187
222
188
223
Below MUST be implemented **in addition** to "HTTP Response" of :cite[path-gateway].
@@ -203,6 +238,12 @@ If a CAR stream was requested:
203
238
204
239
MUST be returned and set to `attachment` to ensure requested bytes are not rendered by a web browser.
205
240
241
+
### `Content-Location` (response header)
242
+
243
+
Same as in :cite[path-gateway], SHOULD be returned when Trustless Gateway
244
+
supports more than a single response format and the `format` query parameter is
245
+
missing or does not match well-known format from `Accept` header.
246
+
206
247
# Block Responses (application/vnd.ipld.raw)
207
248
208
249
An opaque bytes matching the requested block CID
@@ -217,7 +258,7 @@ A CAR stream for the requested
217
258
content type (with optional `order` and `dups` params), path and optional
0 commit comments