Is there any way to get CloudFlare to peer with my IPFS node?

#1

I am using CloudFlare’s IPFS stuff and _dnslink to serve a static page. I have an IPFS node running in the cloud that has my assets pinned. My problem is that if the page isn’t accessed in a while, it gets dropped from CloudFlare’s cache. This isn’t a problem in itself, except for once CloudFlare drops the cache, then fetching the page can take up to 5 minutes across multiple retries.

Is there a way I can tell CloudFlare, “when you lose the cache, try here first” rather than relying on IPFS routing to eventually find the files? I also have tried pinning the files via Eternum (pointed to by CF docs) in hopes that perhaps they had a closer connection but that doesn’t really help the issue.

My next step is to setup an auto-fetcher that grabs each of the resources every so often to keep them warm in CF. This feels like a solution that is bad for CloudFlare and would be avoided if it just provided a mechanism for me telling it “this is where you can probably find the hashes referred to by this domain”.

#2

Prefetching is available to Enterprise customers.

Other than that your auto-fetcher would not help since every edge server keeps its cache for a few hours and doesn’t share it with other edge servers.

1 Like
#3

Hmm, I was operating under the assumption that if one edge server has it then at least the other edge servers can get it quickly? That is, rather than going to IPFS network for the resource, CloudFlare would first check its internal network for the resource first?

#4

I don’t believe prefetching will work with IPFS because I don’t have the ability to set HTTP response headers for IPFS resources:

Include a Link HTTP response header pointing to a manifest file with the rel=”prefetch” attribute, see the detailed example below (replace the URL with your manifest file URL).

#5

It appears that @Xaq was correct, and the caching is on a per edge basis and the edge servers don’t fetch from each other. Unfortunately, at the moment this makes _dnslink CF hosting fairly useless for any sort of actual web app because a good portion of the time when a user hits your site they’ll spend 5-10 minutes on initial page load unless your site has enough traffic to stay warm across all CF edge servers.

I think for this feature to be actually useful, CF needs to support users being able to point at an IPFS host that is known to have the data pinned so that CF edge hosts can quickly fetch the necessary data when it has a cold cache. I have an IPFS server that can easily serve the page in a few milliseconds, but finding the page over the IPFS network takes minutes.

1 Like
closed #6

This topic was automatically closed after 14 days. New replies are no longer allowed.