Skip to content

DNSLink gateways

When you set up a gateway with a DNSLink record, that gateway is restricted to a particular piece of content — either a specific Content Identifier (CID) or an Interplanetary Name Service (IPNS) hostname. This is called a restricted gateway.

A restricted gateway differs from a universal gateway, which allows users to access any content hosted on the IPFS network.

Every file on IPFS is identified by a CID — a long string like bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze. These CIDs are not practical for end users to type or remember, the same way IP addresses (192.0.2.1) are not practical compared to domain names (example.com).

DNSLink solves this by mapping a human-readable domain name to an IPFS CID through a DNS TXT record. You put your website files into an IPFS directory and create a DNSLink record pointing your domain to that directory's CID. Users then access your site through a readable URL like https://cf-ipfs.com/ipns/en.wikipedia-on-ipfs.org/, and the gateway resolves it to the correct CID.

DNSLink also simplifies content updates. When you publish a new version of your site, update the DNSLink record to point to the new CID and the gateway serves the new version automatically — no need to share a new URL.

How is it used with Cloudflare?

You have the option to specify the DNSLink when you create an IPFS gateway, which serves as a custom hostname that directs users to a website already hosted on IPFS.

By default, your DNSLink path is /ipns/onboarding.ipfs.cloudflare.com. If you choose to put your website in a different content folder hosted at your own IPFS node or with a pinning service, you will need to specify that value.

For example, the default DNSLink record for www.example.com would look like this:

Record typeNameContent
TXT_dnslink.www.example.comdnslink=/ipns/onboarding.ipfs.cloudflare.com

For more details about the DNS records created by the IPFS gateway, refer to Gateway DNS records.