Skip to content

Commit b67dac3

Browse files
authored
chore: update format and accept docs (#1897)
* chore: update format and accept docs updating example to match SHOULD from specs ipfs/specs#478 * chore: fix lint and broken links * chore: update links to specs.ipfs.tech website
1 parent fe522fe commit b67dac3

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

docs/reference/http/gateway.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ description: HTTP Gateway API reference for IPFS clients.
55

66
# HTTP Gateway reference
77

8-
Gateways provide implementation and runtime agnostic HTTP interface for retrieving [content-addressed](../../concepts/glossary/#content-addressing) data from IPFS with regular HTTP clients and libraries.
8+
Gateways provide implementation and runtime agnostic HTTP interface for retrieving [content-addressed](../../concepts/glossary.md#content-addressing) data from IPFS with regular HTTP clients and libraries.
99

1010

1111
## API
1212

1313
### `GET /ipfs/{cid}[/{path}][?{params}]`
1414

15-
- `cid` is a [CID](../../concepts/glossary/#cid), the root identifier of the requested content path
15+
- `cid` is a [CID](../../concepts/glossary.md#cid), the root identifier of the requested content path
1616
- `path` – optional path under the root CID
1717

1818
Optional query parameters:
@@ -23,7 +23,7 @@ Optional query parameters:
2323

2424
::: tip Before you continue
2525

26-
Make sure you understand [how to address IPFS on the web](../../how-to/address-ipfs-on-web/) and the differences between [Path Gateways](../../how-to/address-ipfs-on-web/#path-gateway) and [Subdomain Gateways](../../how-to/address-ipfs-on-web/#subdomain-gateway).
26+
Make sure you understand [how to address IPFS on the web](../../how-to/address-ipfs-on-web.md) and the differences between [Path Gateways](../../how-to/address-ipfs-on-web.md#path-gateway) and [Subdomain Gateways](../../how-to/address-ipfs-on-web.md#subdomain-gateway).
2727

2828
:::
2929

@@ -50,7 +50,7 @@ When fetching a CID directly, one can include a `filename` parameter with file n
5050

5151
### Trustless, verifiable retrieval
5252

53-
Clients capable of verifying content-addressed data on their own, should use [application/vnd.ipld.raw](https://www.iana.org/assignments/media-types/application/vnd.ipld.raw) and [application/vnd.ipld.car](https://www.iana.org/assignments/media-types/application/vnd.ipld.car) response types (raw [blocks](../../concepts/glossary/#block) and [CARs](../../concepts/glossary/#car)) and always ask for CIDs directly (`/ipfs/{cid}`).
53+
Clients capable of verifying content-addressed data on their own, should use [application/vnd.ipld.raw](https://www.iana.org/assignments/media-types/application/vnd.ipld.raw) and [application/vnd.ipld.car](https://www.iana.org/assignments/media-types/application/vnd.ipld.car) response types (raw [blocks](../../concepts/glossary.md#block) and [CARs](../../concepts/glossary.md#car)) and always ask for CIDs directly (`/ipfs/{cid}`).
5454

5555
::: callout
5656

@@ -60,28 +60,28 @@ This mode of operation removes the need for trusting gateway returns correct dat
6060

6161
#### Example: fetching an entire DAG as a CAR stream from a public gateway
6262

63-
Using `Accept` HTTP header with [application/vnd.ipld.car](https://www.iana.org/assignments/media-types/application/vnd.ipld.car) type:
63+
To request [application/vnd.ipld.car](https://www.iana.org/assignments/media-types/application/vnd.ipld.car) response type:
6464

6565
```bash
66-
$ curl -H "Accept: application/vnd.ipld.car" "https://ipfs.io/ipfs/bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q" > dag.car
66+
$ curl -H "Accept: application/vnd.ipld.car" "https://ipfs.io/ipfs/bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q?format=car" -L > dag.car
6767
$ ipfs dag import dag.car
6868
```
6969

7070
::: tip
7171

72-
An alternative is to pass `?format=car` URL parameter:
72+
A Client SHOULD include the [`format` query parameter](https://specs.ipfs.tech/http-gateways/trustless-gateway/#format-request-query-parameter) in the request URL, ideally in addition to the [`Accept` header](https://specs.ipfs.tech/http-gateways/trustless-gateway/#accept-request-header). This provides the best interoperability and ensures consistent HTTP cache behavior across various gateway implementations.
7373

7474
<https://ipfs.io/ipfs/bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q?format=car>
7575

76-
:::
76+
:::
7777

7878
::: tip Verify CAR without running full IPFS node
7979

8080
CAR verification does not require running IPFS node. Clients can leverage standalone tools and libraries such as [ipfs-car](https://www.npmjs.com/package/ipfs-car):
8181

8282
```bash
8383
$ npm i -g ipfs-car
84-
$ curl "https://ipfs.io/ipfs/bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q?format=car" | ipfs-car
84+
$ curl "https://ipfs.io/ipfs/bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q?format=car" -L | ipfs-car
8585
$ ls ./bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q/
8686
1007 - Sustainable - alt.txt
8787
1007 - Sustainable - transcript.txt
@@ -92,46 +92,45 @@ $ ls ./bafybeiakou6e7hnx4ms2yangplzl6viapsoyo6phlee6bwrg4j2xt37m3q/
9292

9393
#### Example: fetching a single raw block from a public gateway
9494

95-
Using `Accept` HTTP header with [application/vnd.ipld.raw](https://www.iana.org/assignments/media-types/application/vnd.ipld.raw) type:
95+
To request [application/vnd.ipld.raw](https://www.iana.org/assignments/media-types/application/vnd.ipld.raw) response type:
9696

9797
```bash
98-
$ curl -H "Accept: application/vnd.ipld.raw" "https://ipfs.io/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi" > raw-block.bin
98+
$ curl -H "Accept: application/vnd.ipld.raw" "https://ipfs.io/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi?format=raw" -L > raw-block.bin
9999
$ ipfs block put raw-block.bin
100100
bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi
101101
```
102102

103-
104103
::: tip
105104

106-
An alternative is to pass `?format=raw` URL parameter:
105+
A Client SHOULD include the [`format` query parameter](https://specs.ipfs.tech/http-gateways/trustless-gateway/#format-request-query-parameter) in the request URL, ideally in addition to the [`Accept` header](https://specs.ipfs.tech/http-gateways/trustless-gateway/#accept-request-header). This provides the best interoperability and ensures consistent HTTP cache behavior across various gateway implementations.
107106

108107
<https://ipfs.io/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi?format=raw>
109108

110109
:::
111110

112111
## Specifications
113112

114-
The HTTP Gateway specification for IPFS implementers is available in [ipfs/specs repository](https://github.com/ipfs/specs/blob/main/http-gateways/#readme).
113+
The HTTP Gateway specification for IPFS implementers is available at [specs.ipfs.tech](https://specs.ipfs.tech/http-gateways/).
115114
Below are links for the most useful specifications.
116115

117116

118117
### HTTP
119118

120119
These are "low level" gateways that expose IPFS resources over HTTP protocol.
121120

122-
* [Path Gateway](https://github.com/ipfs/specs/blob/main/http-gateways/PATH_GATEWAY.md)**START HERE**, other types of gateway are specified as a delta against this specification.
123-
* [Trustless Gateway](https://github.com/ipfs/specs/blob/main/http-gateways/TRUSTLESS_GATEWAY.md) is a subset that returns verifiable response types (raw [blocks](../../concepts/glossary/#block) and [CARs](../../concepts/glossary/#car))
121+
* [Path Gateway](https://specs.ipfs.tech/http-gateways/path-gateway/)**START HERE**, other types of gateway are specified as a delta against this specification.
122+
* [Trustless Gateway](https://specs.ipfs.tech/http-gateways/trustless-gateway/) is a subset that returns verifiable response types (raw [blocks](../../concepts/glossary.md#block) and [CARs](../../concepts/glossary.md#car))
124123

125124
### Web
126125

127126
Special types of gateway which leverage `Host` header in addition to URL `pathname`. Designed for website hosting and improved interoperability with web browsers and [origin-based security model](https://en.wikipedia.org/wiki/Same-origin_policy).
128127

129-
* [Subdomain Gateway](https://github.com/ipfs/specs/blob/main/http-gateways/SUBDOMAIN_GATEWAY.md)
130-
* [DNSLink Website Hosting](https://github.com/ipfs/specs/blob/main/http-gateways/DNSLINK_GATEWAY.md)
128+
* [Subdomain Gateway](https://specs.ipfs.tech/http-gateways/subdomain-gateway/)
129+
* [DNSLink Website Hosting](https://specs.ipfs.tech/http-gateways/dnslink-gateway/)
131130

132131
::: tip
133132

134-
If you are a gateway operator or an implementer, consider joining [Gateway Operators Forum](https://discuss.ipfs.tech/c/31)
133+
If you are a gateway operator or an implementer, consider testing with [gateway-conformance](https://github.com/ipfs/gateway-conformance) test suite.
135134

136135
:::
137136

0 commit comments

Comments
 (0)