Skip to content

How to set up TON Proxy

TON Proxy bridges HTTP traffic to ADNL. This page covers two setups:

  • Forward proxy: browse TON Sites from a conventional browser.
  • Reverse proxy: host a TON Site behind an ADNL endpoint. See the reverse proxy overview for the concept.

Accepts browser HTTP requests on a local port and forwards them to TON Sites over ADNL.

  • rldp-http-proxy binary from a TON monorepo release (v2024.01 or newer) or built from source
  • Optional alternative: Tonutils-Proxy (v1.8.0 or newer), a Go client with a GUI and built-in tunnel support
  • TON global network configuration file (global.config.json), available from the TON monorepo

Start the forward proxy:

Terminal window
rldp-http-proxy -p 8080 -c 3333 -C global.config.json

Configure the browser HTTP proxy to 127.0.0.1:8080. TON Sites are reachable by .ton domain names. The full flag list is documented in the TON Proxy reference.

Tonutils-Proxy is a Go alternative with built-in support for garlic-routed ADNL tunnels.

FieldDefaultDescription
TunnelSectionsNum1Number of relay hops
MaxPricePerPacket0Maximum nanoTON per packet, 0 = no limit
NodesPoolConfigPathemptyPath to a JSON file pinning specific relays

The tunnel rebuilds automatically after 45 seconds of inactivity.

Request a known TON Site through the proxy:

Terminal window
curl --proxy http://127.0.0.1:8080 http://foundation.ton/

A successful response returns HTML content from the TON Foundation site. ps aux | grep rldp-http-proxy (or ps aux | grep tonutils-proxy) confirms the process is running.

  • Port already in use: another process is bound to port 8080. Change the port with -p <PORT> and update the browser proxy setting accordingly.
  • global.config.json not found: the -C flag path must point to the actual file location. Pass the absolute path or run from the directory containing the file.
  • .ton domain does not resolve: the proxy connects to the TON DHT on startup. Wait a few seconds after launch, then retry. Check that UDP outbound traffic on port 3333 (or the port set by -c) is not blocked by a firewall.

Accepts inbound ADNL connections and forwards HTTP requests to a local web server, enabling hosting for a TON Site.

  • rldp-http-proxy binary from a TON monorepo release (v2024.01 or newer), or tonutils-reverse-proxy binary from the tonutils/reverse-proxy releases (v0.4.0 or newer)
  • generate-random-id binary (included in the TON monorepo release archive): required for the rldp-http-proxy key generation step
  • global.config.json: available from the TON monorepo
  • A public IPv4 address with an open UDP port (default: 3333) reachable from the internet

Create a keyring directory and generate a key pair:

Terminal window
mkdir keyring
Terminal window
generate-random-id -m keys -n liteserver

This produces liteserver (private key) and liteserver.pub (public key) in the current directory.

Move the private key into the keyring:

Terminal window
mv liteserver keyring/

The hex-encoded key ID printed by generate-random-id is the ADNL address (<ADNL_ADDRESS>).

Terminal window
rldp-http-proxy -a <PUBLIC_IP>:3333 -L '*' -C global.config.json -A <ADNL_ADDRESS> -d -l <LOG_FILE>
FlagDescription
-a <PUBLIC_IP>:3333Public IP and UDP port for ADNL connections
-L '*'Accept requests for any hostname
-C global.config.jsonPath to TON global network configuration
-A <ADNL_ADDRESS>ADNL address generated in step 1
-dRun as daemon
-l <LOG_FILE>Path to the log file

The reverse proxy forwards incoming HTTP requests to 127.0.0.1:80 by default. Point a local web server at that address.

Download the latest tonutils-reverse-proxy-linux-amd64 binary from the releases page and make it executable:

Terminal window
chmod +x tonutils-reverse-proxy-linux-amd64

Alternatively, build from source:

Terminal window
git clone https://github.com/tonutils/reverse-proxy.git
cd reverse-proxy
make build

Start with domain assignment:

Terminal window
./tonutils-reverse-proxy-linux-amd64 --domain <DOMAIN>

On first launch the binary generates an ADNL key pair automatically and prints a QR code linking to a TON DNS configuration transaction. Scan the QR code with a TON wallet to register the ADNL address in the domain record.

The reverse proxy injects two headers into forwarded requests:

HeaderDescription
X-Adnl-IpClient ADNL IP (not the real client IP)
X-Adnl-IdClient ADNL identity

After the reverse proxy is running, register the ADNL address in a .ton domain via TON DNS. Set the site record of the domain to the ADNL address of the reverse proxy.

Confirm the ADNL address is reachable and DNS is active:

  1. Use the forward proxy above and request the .ton domain in a browser to confirm end-to-end routing.
  2. Check that the ADNL address is registered in the domain’s site record via a TON DNS lookup tool such as dns.ton.org.
  3. Inspect the reverse proxy log (-l <LOG_FILE>) for incoming connection entries to confirm traffic is arriving.
  • Firewall blocking UDP: the public UDP port (default 3333) must be open inbound. Verify with nc -u -zv <PUBLIC_IP> 3333 from an external host. Update firewall rules if the port is filtered.
  • Private key not loaded: the private key file must reside inside the keyring/ directory and the directory must be in the working directory where rldp-http-proxy is launched. Check that keyring/<KEY_FILE> exists.
  • DNS propagation delay: after the on-chain DNS transaction is confirmed, allow up to 60 seconds for the record to propagate across DHT nodes before testing.
  • tonutils-reverse-proxy QR code does not appear: ensure the terminal supports block characters. Run with a UTF-8 locale or redirect the output and scan the raw URL printed alongside the QR code.