1

I So I have a IPFS daemon running on an ubuntu VPS, and it's reportedly is listening...

API server listening on /ip4/127.0.0.1/tcp/5001
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

I have also setup an DNS A Record for ipfs.domain.com to point at the servers IP address. I have also added the DNS TXT record for ipfs.domain.com as...

dnslink=/ipns/QmeQe5FTgMs8PNspzTQ3LRz1iMhdq9K34TQnsCP1jqt8wV

So my first question is how do I link ipfs.domain.com to /ip4/127.0.0.1/tcp/8080

My second questions is, what if the server is offline/unreachable for some reason, is there a way of having some kind of fall back to go to some other gateway?

My Third question is how do specify the caching rules, so images can be cached at least 1 week into the future and the site can get a vary: Accept-Encoding header

2 Answers 2

2

Make sure the daemon is running on host 0.0.0.0 which you can configure with ipfs config:

sudo ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
sudo ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/9001

To map a domain to your gateway you can use a load balancer such as nginx.

1

Try making the Gateway to listen to 0.0.0.0 instead of 127.0.0.1, otherwise it won't accept connections that aren't coming from the local computer.

After that, your DNS configuration should be good.

dnslink is specifically for linking to content hosted in the IPFS network (so not applicable in your case). You can't link to your node but you can publish content under your node's ID. More about how that works here: https://github.com/ipfs/examples/tree/master/examples/websites

Regarding caching, there is no need to specify the amount of time content should be cached since it's all immutable and will never change. Once requested, your node will hold on to it until garbage collection runs, then all content except pinned things will be deleted and have to be re-fetched from the network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.