Skip to main content

Configure CDN for IPFS Service

We recommend putting a CDN on top of your IPFS gateway. CDNs help distribute your content efficiently, so your media is always accessible as quickly as possible. These instructions walk through the process of setting up a Cloudflare CDN for an IPFS gateway, but any other CDN provider can work as well.

Note: CDN distributions require you to own your own domain. Please buy a domain from a domain registrar if you haven't already

1. Service Settings

First things first, you'll need to configure your IPFS Gateway to use your custom domain. We recommend delegating a sub-domain for this, such as ipfs.example.com

Head over to your IPFS service settings, and input your Custom Domain, then click Add.

Zeet will prompt you with some DNS instructions, you'll put these into Cloudflare in the next step.

2. Cloudflare DNS

If you haven't already, sign up for Cloudflare. Create a new site with the same domain as you put into Zeet. Cloudflare will ask you to switch your NS DNS records to their servers. We will assume you've already completed those steps.

Once the root domain is in Cloudflare, we need to tell Cloudflare to route our sub-domain to the IPFS Gateway. To do this, go to the DNS section and click Add Record.

This is where you'll add the records from Zeet in Step 1. Ensure that Proxy Status is enabled, and shows "Proxied."

info

DNS propagation might take a few minutes, during which time your domain may not work properly.

3. Cloudflare rule

Now that we have a Cloudflare site, we need to tell it how to cache. To do this, we'll navigate to the Rules section of the website in Cloudflare's UI.

Create a new Rule for your IPFS sub-domain. The URL match should look like this: ipfs.example.com/ipfs/* The Rule should have Always Online and Cache Everything on it, to ensure the best reliability for your media.

4. Cloudflare SSL

Last but not least, we need to tell Cloudflare to encrpyt your traffic for security. Navigate to the Overview section underneath "SSL / TLS" and ensure you're set up for Full SSL encryption.

5. Try it out!

And with that, you're done! Try uploading a file to IPFS through the Zeet UI and fetching it with your Cloudflare domain.

Resources