This is an example of building a "verifying proxy" Gateway that has no
local on-disk blockstore, but instead, uses application/vnd.ipld.car
and
application/vnd.ipfs.ipns-record
responses from a remote HTTP server that
implements CAR support from Trustless Gateway
Specification.
NOTE: the remote CAR backend MUST implement IPIP-0402: Partial CAR Support on Trustless Gateways
> go build -o gateway
First, you need a compliant gateway that supports both CAR requests and IPNS Record response types. Once you have it, run the proxy gateway with its address as the host parameter:
./gateway -g https://trustless-gateway.link -p 8040
Now you can access the gateway in localhost:8040
. It will
behave like a regular subdomain gateway,
except for the fact that it runs no libp2p, and has no local blockstore.
All data is provided by a remote trustless gateway, fetched as CAR files and IPNS Records, and verified locally.
If you don't need Origin isolation and only care about hosting flat files,
a plain path gateway at
127.0.0.1:8040
may suffice.
Gateway supports hosting of DNSLink websites. All you need is to pass Host
header with FQDN that has DNSLink set up:
$ curl -sH 'Host: en.wikipedia-on-ipfs.org' 'http://127.0.0.1:8080/wiki/' | head -3
<!DOCTYPE html><html class="client-js"><head>
<meta charset="UTF-8">
<title>Wikipedia, the free encyclopedia</title>
Put it behind a reverse proxy terminating TLS (like Nginx) and voila!