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
+39-24Lines changed: 39 additions & 24 deletions
Display the source diff
Display the rich diff
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,6 +242,16 @@ 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
257
Only used on CAR requests, same as :ref[dag-scope] from :cite[trustless-gateway].
@@ -486,30 +496,42 @@ To illustrate, `?filename=testтест.pdf` should produce:
486
496
not attempt to render raw bytes. CID and `.bin` file extension should be used
487
497
if a custom `filename` was not provided with the request.
488
498
499
+
### `Content-Location` (response header)
500
+
501
+
Returned when a non-default content format has been negotiated with the
502
+
[`Accept` header](#accept-request-header) but `format` was missing from the URL.
503
+
504
+
The value of this field SHOULD include
505
+
the URL of the resource with the `format` query parameter included, so that
506
+
generic HTTP caches can store deserialized, CAR, and block responses separately.
507
+
508
+
:::note
509
+
510
+
For example, a request to `/ipfs/{cid}` with `Accept: application/vnd.ipld.raw`
511
+
SHOULD return a `Content-Location: /ipfs/{cid}?format=raw` header in order for
512
+
block response to be cached separately from deserialized one.
513
+
514
+
:::
515
+
489
516
### `Content-Length` (response header)
490
517
491
518
Represents the length of returned HTTP payload.
492
519
520
+
:::warning
521
+
522
+
<!-- TODO https://github.com/ipfs/specs/issues/461 -->
523
+
493
524
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. -->
525
+
See [ipfs/specs#461](https://github.com/ipfs/specs/issues/461).
526
+
527
+
:::
495
528
496
529
### `Content-Range` (response header)
497
530
498
531
Returned only when request was a [`Range`](#range-request-header) request.
499
532
500
533
See Section 14.4 of :cite[rfc9110].
501
534
502
-
### `Content-Location` (response header)
503
-
504
-
Returned when a non-default content format has been negotiated with the
505
-
[`Accept` header](#accept-request-header). The value of this field SHOULD include
506
-
the URL of the resource with the `format` query parameter included, so that
507
-
generic HTTP caches can store deserialized, CAR, and block responses separately.
508
-
509
-
For example, a request to `/ipfs/{cid}` with `Accept: application/vnd.ipld.raw`
510
-
SHOULD return a `Content-Location: /ipfs/{cid}?format=raw` header in order for
511
-
this request to be able to be successfully cached.
512
-
513
535
### `Accept-Ranges` (response header)
514
536
515
537
Optional, returned to explicitly indicate if gateway supports partial HTTP
@@ -524,8 +546,6 @@ deterministic.
524
546
Returned only when response status code is [`301` Moved Permanently](#301-moved-permanently).
525
547
The value informs the HTTP client about new URL for requested resource.
526
548
527
-
This header is more widely used in [SUBDOMAIN_GATEWAY.md](./SUBDOMAIN_GATEWAY.md#location-response-header).
528
-
529
549
#### Use in directory URL normalization
530
550
531
551
Gateway MUST return a redirect when a valid UnixFS directory was requested
@@ -541,6 +561,10 @@ It also ensures the same behavior on path gateways (`https://example.com/ipfs/ci
541
561
and origin-isolated HTTP contexts `https://cid.ipfs.dweb.link`
542
562
or non-HTTP URLs like `ipfs://cid`, where empty path component is implicit `/`.
543
563
564
+
#### Use in interop with Subdomain Gateway
565
+
566
+
See [`Location` section](https://specs.ipfs.tech/http-gateways/subdomain-gateway/#location-response-header) of :cite[subdomain-gateway].
567
+
544
568
### `X-Ipfs-Path` (response header)
545
569
546
570
Used for HTTP caching and indicating the IPFS address of the data.
@@ -578,15 +602,6 @@ NOTE: while the first CID will change every time any article is changed,
578
602
the last root (responsible for specific article or a subdirectory) may not
579
603
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
+17-4Lines changed: 17 additions & 4 deletions
Display the source diff
Display the rich diff
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,14 @@ 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:
0 commit comments