Dark mode switch icon Light mode switch icon

How to | Adding an IPFS link to any domain

Using IPNS, we can relate IPFS content to a domain name.

2 min read Namaskar 🙏

First, why would you want this? IPNS is another way to access content on the IPFS network. Since the link to the content is set on the DNS itself, the attack surface is slightly smaller, as the malicious user would need access at the DNS level to be successful. Also, as it’s closer to traditional website access, while also showing the user direct IPFS accessing of the content is happening.

There’s more information about what’s IPNS? as well as a great guide about how resolving DNSLink works, but I’ll go over the steps in a very high-level manner here.

The next steps you can try yourself, and you should be able to see Uniswap’s Interface at the end.

1️⃣ Get your CID for the site you want to share with users. It will look something like bafybeibngzztaxprxg6w423plup5kihnizu4t4fdcsq73wgqcayvjrxoaq.

2️⃣ Go to your DNS provider and add a record to your domain.

TXT _dnslink   dnslink=/ipfs/bafybeibngzztaxprxg6w423plup5kihnizu4t4fdcsq73wgqcayvjrxoaq

If you want a subdomain, e.g. ipfs.example.com, the subdomain used would be _dnslink.ipfs

TXT _dnslink.ipfs dnslink=/ipfs/bafybeibngzztaxprxg6w423plup5kihnizu4t4fdcsq73wgqcayvjrxoaq

3️⃣ After set, you can direct users to the site via IPNS and a gateway. These would be accessible with a gateway, like Cloudflare, using their ipns path using subdomains (recommended):

or using paths (not recommended):

What are the downsides? For one, the record will not be updated if you push changes to your code. This will need to be either automated (if the DNS supports it) or done manually.

We do not currently try updating the IPNS record as we handle the CID resolution automatically when setting up a domain on dAppling, but we think IPNS is an interesting access point, and it’s more accessible.

Originally published on by dAppling