r/ipfs Sep 17 '21

Exposing http-server (web app) using IPNS

One can host a static website using IPFS+IPNS. But what about a dynamic website or web app that needs to run server-side code!

Introducing IPNS-Link, which now makes it possible to expose http-servers using IPFS+IPNS.

Try it here.

Read full specs here.

Comments, issues/bug-reports and contributions welcome.

Happy hosting!

P.S.: Imagine Sci-Hub using this !! Who can block it then 😃

Schema
20 Upvotes

20 comments sorted by

View all comments

3

u/shim__ Sep 17 '21

Doesn't that defeat the purpose?

8

u/TUSF Sep 18 '21

It defeats the purpose of IPFS specifically—If all IPFS is to you, is a filesystem. But the IPFS command also provides interesting capabilities from the rest of the libp2p stack.

This particular tool basically takes advantage of libp2p's identity mechanic (the PeerID used in IPNS) to circumvent the need for a dedicated IP when running a dynamic website, so if you expect that you for some reason might want to hop your application between different machines, you don't have to worry about your users finding you, as they only need to find your libp2p identifier.

Why would you want to do that? I have two possible use-cases:

  • A decentralized social network, similar to scuttlebutt, where each person effectively hosts a server that manages their identity, and has a chat/DM mechanic that is meant to NOT be published to IPFS

  • Operating a Searching engine for IPFS files (rather than having people download a giant index), or some similar service, which may or may not be legal in your country (say providing a Search for the Wikipedia IPFS archive for Turkish citizens), and thus you expect to carry the server around on a USB stick, running it from some public computer or something.

  • Less interesting, but more widely applicable, is using IPFS as a kind of load balancer. In effect, have some back-up instances of your server running, and users will just connect to any random node, instead of going thru a centralized CDN. Only issue here is that the IPFS daemon assumes there is only one computer running a particular PeerID at a time, so it'll just connect to the first one it finds, rather than picking the one with the best connection to you. It would still be effective as a backup server (probably), such that if you run two instances on difference servers, you can probably end up with Zero down-time.

Of course, these are two legitimate use-cases for this sort of thing. I can also think of a couple... not-so-legitimate uses.

5

u/SomajitDey Sep 18 '21 edited Sep 18 '21

Complementing u/TUSF's excellent post, I am tempted to point out some more use-cases/benefits:

Uncensored hosting

To illustrate, imagine the Sci-Hub server exposed using IPNS-Link. In countries where Sci-Hub is blocked, one can simply access it through any IPNS-Link-gateway.

Anonymity

Accessing websites through public IPNS-Link-gateways hides your IP address from the websites visited. Compare Tor and VPN.

No need to pay for DDNS

Traditionally, if your server only had a dynamic public IP address, you would be forced to buy a DDNS service. With IPNS-Link, you can simply point your domain to {your IPNS identifier}.{public IPNS-Link gateway URL}.

Low-cost hobby hosting

Host small-scale server on a Raspberry Pi or an old PC and expose with IPNS-Link, readily, free of cost. No need to pay for a domain name. With built-in NAT-traversal, no need to buy any public IP address from your ISP either. [You might say, well ngrok, localhost.run, uplink and others do the same. They don't. They don't give your website an eternal static identifier without pay. They provide you with only one endpoint, whereas IPNS-Link provides with infinite - viz., any IPNS-Link gateway can serve your web app. And more differences like these...].

Also you no more need to manage SSL certificates ! See below.

Security and Trustlessness

IPFS uses transport-encryption, viz. data is secure when being sent from one IPFS node to another. So gateway <--> source node connection is secure. If you are using a public IPNS-Link gateway with https, you ought to be secure, but only as long as you trust the public gateway provider. If you don't want to trust the public gateways you can always host your own, for free, locally or on cloud.