DNSLink Gateway is an extension of [path-gateway] that enables hosting a specific content path under a specific DNS name.
This document describes the delta between [path-gateway] and this gateway type.
In short:
Host
headerGET /[{path}][?{params}]
Downloads data at specified path under the content path for DNSLink name provided in Host
header.
path
– optional path to a file or a directory under the content root sent in Host
HTTP header
Host: example.com
then the content path to resolve is /ipns/example.com/{path}
HEAD /[{path}][?{params}]
Same as GET, but does not return any payload.
Below MUST be implemented in addition to "HTTP Request" of [path-gateway].
Host
(request header)Defines the DNSLink name
to RECURSIVELY resolve into an immutable /ipfs/{cid}/
prefix that should
be prepended to the path
before the final IPFS content path resolution
is performed.
Implementations MUST ensure DNSLink resolution is safe and correct:
Example: resolving an advanced DNSLink chain
To illustrate, given DNSLink records:
_dnslink.a.example.com
TXT record: dnslink=/ipns/b.example.net/path-b
_dnslink.b.example.net
TXT record: dnslink=/ipfs/bafy…qy3k/path-c
HTTP client sends GET /path-a
request with Host: a.example.com
header
which recursively resolves all DNSLinks and produces the final immutable
content path:
Host
header + /path-a
→ /ipns/a.example.net/path-a
a.example.net
replaces /ipns/a.example.net
with /ipns/b.example.net/path-b
b.example.net
replaces /ipns/b.example.net
with /ipfs/bafy…qy3k/path-c
/ipfs/bafy…qy3k/path-c/path-b/path-a
Same as "HTTP Response" of [path-gateway].
DNSLink Gateway implementations SHOULD include _redirects
file support
defined in [web-redirects-file].