Best practices for running IPFS Companion with a remote IPFS node?


I’m playing around with IPFS, and I’m curious what the best practices are considered to be for running the IPFS browser companion when your IPFS node is running on a remote server and not your local machine.

When installing IPFS on Ubuntu as a snap on a remote server (Install ipfs on Ubuntu using the Snap Store | Snapcraft), I’ve noticed that I need to set up an SSH tunnel for both port 5001 and 8080 in order for IPFS Companion to behave normally, as it expects to reach those on localhost by default, and those ports aren’t exposed beyond localhost on my server out of the box. This makes me think that what I’m doing isn’t supported…

Can someone clear up the expected behavior for me? Thanks!

SSH Tunnels or a VPN is the correct way of doing it.

I use SSH Tunnels personally.
But VPN is also a strong option and some might prefer it because it feels less hacky (require more setup time that I’m not willing to invest for my setup tho).

SSH tunnel has one big advantage over VPN: you will be talking to ports that look like localhost, allowing you to use subdomain gateway at localhost:8080, which is marked as secure context in web browsers. Random IPs from VPN won’t be able to provide that.

1 Like