Link a domain to a dApp hosted on IPFS

Alexander Lechner
Coinmonks
4 min readJan 20, 2022

--

A quick step-by-step guide on how to link a domain to a dApp hosted on IPFS

This article is part 4 of a series on how to build and host a dApp on Avalanche. Check out the other parts here:

Step 1:

In this tutorial we’re going to link a traditional domain name to a dApp hosted on IPFS. If you do not already have a dApp hosted on IPFS, check out the previous tutorials.

For this tutorial we’re going to use the dApp hosted on IPFS under this CID:

https://ipfs.io/ipfs/QmYupNAG5sb6nhgYp5LFzDAW9Tn9kHRQwbLrbKBbbDneAp

To link a domain to a IPFS document, we need to update the DNS settings of the domain. So go to your domain registrar and open the DNS settings. In case of GoDaddy the settings look like this:

Step 2:

To link a domain to a IPFS document we need to create 2 DNS entries:

  • a CNAME entry: to link the domain to a IPFS gateway
  • a TXT entry: to link the domain to a specific IPFS document (CID)

In this tutorial we’ll only point a subdomain dapp.lechneralexander.com to the dApp, so let’s first add a CNAME entry, setting the host to dapp and value to gateway.ipfs.io.:

Now we’ll add a TXT entry with host _dnslink.dapp and value dnslink=/ipfs/YOUR_DAPP_CID:

If you want to use a different subdomain you can simply replace dapp with your desired subdomain in both CNAME and TXT settings. If you want to point the domain itself (instead of a subdomain) to an IPFS document, you need to set the CNAME host to @ and the TXT host to _dnslink.

Save your DNS updates and wait for a bit. Depending on your registrar, changes to DNS can take a couple of minutes / hours to become effective.

Alternative: instead of using gateway.ipfs.io as gateway, you can also use the gateway provided by Cloudflare cloudflare-ipfs.com. Cloudflare adds a caching layer in front of IPFS, so using the Cloudflare gateway usually results in faster page loads.

Step 3:

That’s it already, you can now access the IPFS hosted dApp by calling the subdomain in your browser: http://dapp.lechneralexander.com.

Step 4: Update your dApp

Whenever you release a new version of your dApp, you will also need to update the TXT record in your DNS settings. The Cloudflare IPFS documentation links to a couple of projects that you can use to automate this process.

Coming up:

In this tutorial we linked a traditional domain to an IPFS document (an dApp on the Avalanche network). In an upcoming tutorial, we’ll investigate using a decentralised domain (like ENS or Handshake) instead.

Resources & Links:

Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing

Also Read

--

--