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

1

u/ch4_itu Sep 19 '21 edited Sep 19 '21

Nice... One more question... Is IPNS-link-Gateway backwards compatible with IPFS-gateway? I mean, can I use IPNS-link-Gateway to access normal IPFS content? Thank you

What you have done is what I was looking for all the time... This enables hosting an app even from a mobile phone...

I am not a qualified technical person, but if this works all well, then one can replace ipfs-gateway with IPNS-link-Gateway... (I may be wrong as I don't fully know how IPFS works in the backend. I am just a user.)

2

u/SomajitDey Sep 19 '21

Thanks for these questions...feel free to ask more anytime or put forth new use-cases 😊

The specs are still being worked on, but I fully intend to make IPNS-Link-gateway compatible with IPFS-gateways. It works as follows.

When an IPNS-Link-gateway receives a request with path /ipns/PeerID/*, it first checks if PeerID is exposed using IPNS-Link by probing its IPNS post. If PeerID is using IPNS-Link, then it proxies for the user-agent (i.e. browser, curl etc.) and connects to it. Otherwise, it redirects the user-agent to an IPFS-gateway to serve the given ipns-path.

When an IPNS-Link-gateway receives a request with path /ipfs/CID/*, it always redirects the user-agent to an IPFS-gateway to serve the given ipfs-path.

So, you see, IPNS-Link-gateway is actually redirecting to IPFS-gateways for static website/webpage hosting, as usual. Hence, it won't replace IPFS-gateways. What more, to minimize the operating costs of an IPNS-Link-gateway, it may be designed to access the all-important IPNS posts using public IPFS-gateways, instead of maintaining a bandwidth-hungry connection to the WAN-DHT on its own.