How TON Sites work
When a user visits a TON Site:- The TON Proxy client accepts an HTTP request from an ordinary web browser.
- The proxy resolves the target address, either through TON DNS (for human-readable
.tondomains) or directly from a known ADNL address. - The HTTP request is encapsulated in RLDP datagrams and sent through the ADNL network to the TON Site’s abstract address.
- The TON Site processes the request and returns an HTTP response.
ADNL address as identity
Every TON Site is identified by a 256-bit ADNL abstract address derived from its public key. Because the ADNL address is independent of the server’s IP address, a site is not tied to any particular server location.Host a TON Site
A TON Site requires a reverse proxy that accepts inbound ADNL connections and forwards them to a local web server. Two implementations are available.Use rldp-http-proxy
rldp-http-proxy is the reverse proxy from the official TON monorepo. Key generation is manual.
Step 1. Generate a persistent ADNL address:
| Flag | Description |
|---|---|
-a <ip>:<port> | Public IP and UDP port for inbound ADNL connections (published to the TON DHT) |
-A <adnl-address> | ADNL address generated in step 1 |
-L <hostname>[:<ports>] | Forward requests for <hostname> to 127.0.0.1 (default ports: 80, 443) |
-R <hostname>[:<ports>]@<ip>:<port> | Forward requests for <hostname> to a remote HTTP server at <ip>:<port> |
-C <file> | Path to the TON global network configuration file |
-D <path> | Database root path |
-d | Daemonize the process |
-l <file> | Log file path |
Use tonutils-reverse-proxy
tonutils-reverse-proxy is a Go implementation that handles key generation and domain linking automatically.
Install on Linux:
.ton domain:
http://127.0.0.1:80. The proxy adds two headers to each forwarded request:
X-Adnl-Ip: the IP address of the connecting client as seen by the ADNL network.X-Adnl-Id: the ADNL node ID of the connecting client.
Domain assignment
To assign the ADNL address to a.ton domain, open the domain in the TON DNS management interface, paste the ADNL address into the “Site” field, and confirm the transaction with the domain owner’s wallet. For record types and resolution details, see TON DNS.
Domain name resolution
TON DNS
Adns_adnl_address record in TON DNS maps a .ton domain name to the ADNL address of the TON Site. The proxy client resolves this record and connects to the correct ADNL address. See TON DNS for the full record type specification.