Skip to content

Commit ba96bba

Browse files
committed
docs(config): Gateway.PublicGateways
License: MIT Signed-off-by: Marcin Rataj <[email protected]>
1 parent c40b1e2 commit ba96bba

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

docs/config.md

+105
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ A boolean to configure whether the gateway is writeable or not.
293293

294294
Default: `false`
295295

296+
296297
- `PathPrefixes`
297298
Array of acceptable url paths that a client can specify in X-Ipfs-Path-Prefix header.
298299

@@ -318,6 +319,110 @@ location /blog/ {
318319

319320
Default: `[]`
320321

322+
- `NoDNSLink`
323+
A boolean to configure whether DNSLink lookup for value in `Host` HTTP header should be performed.
324+
If DNSLink is present, content path stored in it is mounted at `/` and respective payload is returned to the client.
325+
326+
Default: `false`
327+
328+
### Gateway.PublicGateways
329+
330+
`PublicGateways` is a dictionary for overriding default options on specific fully qualified domain names (FQDN).
331+
Options for changing behavior per hostname:
332+
333+
- `NoDNSLink`
334+
Overrides global setting of the same name.
335+
Default: `false`
336+
- `PathPrefixes`
337+
Array of paths that should be mounted at the root of domain name.
338+
**TODO: this does not override global 'PathPrefixes' used for validation of X-Ipfs-Gateway-Prefix header. Should this have different name? eg. PathMounts?**
339+
Example: `["/ipfs", "/ipns", "/api"]`
340+
Default: `[]`
341+
- **Note:** when both `PathPrefixes` and DNSLink are mounted, `PathPrefixes` take priority
342+
- `UseSubdomains`
343+
A boolean to configure whether the gateway provides [Origin isolation](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy)
344+
between content roots.
345+
Default: `false`
346+
- `true` – mount [subdomain gateway](#https://docs-beta.ipfs.io/how-to/address-ipfs-on-web/#subdomain-gateway) at `http://{cid}.ipfs.{hostname}`
347+
- requests for `http://{hostname}/ipfs/{cid}` will return redirect to `http://{cid}.ipfs.{hostname}`
348+
- `false` – mount [path gateway](https://docs-beta.ipfs.io/how-to/address-ipfs-on-web/#path-gateway) at `http://{hostname}/ipfs/{cid}`
349+
- **(not implemented yet)** due to the lack of Origin isolation, cookies and storage will be disabled by [Clear-Site-Data](https://github.com/ipfs/in-web-browsers/issues/157) header
350+
351+
352+
#### Examples of common use cases
353+
354+
* Public [subdomain gateway](https://docs-beta.ipfs.io/how-to/address-ipfs-on-web/#subdomain-gateway) at `http://{cid}.ipfs.dweb.link`
355+
```json
356+
"Gateway": {
357+
"PublicGateways": {
358+
"dweb.link": {
359+
"UseSubdomains": true
360+
```
361+
Version that redirects content paths
362+
to subdomains (`http://dweb.link/ipfs/{cid}`→`http://{cid}.ipfs.dweb.link`) for backward-compatibility:
363+
```json
364+
"Gateway": {
365+
"PublicGateways": {
366+
"dweb.link": {
367+
"UseSubdomains": true,
368+
"PathPrefixes": ["/ipfs", "/ipns"]
369+
```
370+
**TODO: should this backward-compatibility redirect be enabled by the default when `UseSubdomains: true`?**
371+
372+
* Public [path gateway](https://docs-beta.ipfs.io/how-to/address-ipfs-on-web/#path-gateway) at `http://ipfs.io/ipfs/{cid}`
373+
```json
374+
"Gateway": {
375+
"PublicGateways": {
376+
"ipfs.io": {
377+
"UseSubdomains": false,
378+
"PathPrefixes": ["/ipfs", "/ipns", "/api"]
379+
```
380+
381+
* Public [DNSLink](https://dnslink.io/) gateway (accepting every hostname passed in `Host` header)
382+
is enabled by default:
383+
```json
384+
"Gateway": {
385+
"NoDNSLink": false
386+
```
387+
388+
* Site-specific [DNSLink](https://dnslink.io/) gateway.
389+
Disabling public gateway by default (`NoFetch: true`),
390+
and enabling selected gateway features only on specific hostname for which data
391+
is already present on the node:
392+
```json
393+
"Gateway": {
394+
"NoFetch": true,
395+
"NoDNSLink": true,
396+
"PublicGateways": {
397+
"en.wikipedia-on-ipfs.org": {
398+
"NoDNSLink": false,
399+
"PathPrefixes": []
400+
```
401+
**TODO: note how `Gateway.PublicGateways[host].PathPrefixes = []` has a different meaning than `Gateway.PathPrefixes = []`)**
402+
403+
**Note:** Default entries for localhost name and loopback IPs are always present.
404+
User-provided config will be merged on top of implicit values:
405+
```json
406+
{
407+
"Gateway": {
408+
"PublicGateways": {
409+
"127.0.0.1": {
410+
"PathPrefixes": ["/ipfs", "/ipns", "/api"],
411+
"UseSubdomains": false
412+
},
413+
"::1": {
414+
"PathPrefixes": ["/ipfs", "/ipns", "/api"],
415+
"UseSubdomains": false
416+
},
417+
"localhost": {
418+
"PathPrefixes": ["/ipfs", "ipns"],
419+
"UseSubdomains": true
420+
}
421+
}
422+
}
423+
}
424+
```
425+
321426
## `Identity`
322427

323428
- `PeerID`

0 commit comments

Comments
 (0)