Publish Airgate through Cloudflare Tunnel
On a self-managed Airgate server (the single-node Docker Compose
deployment), you can publish Airgate’s web listener through Cloudflare
Tunnel instead of opening TCP 443 to the internet. The cloudflared
connector runs next to Airgate, opens an outbound connection to Cloudflare,
and Cloudflare serves your host name (for example airgate.contoso.com)
with its certificate.
What goes through the tunnel
Section titled “What goes through the tunnel”| Traffic | Through the tunnel |
|---|---|
Console and API (/, /api/v1/…) |
Yes |
Guest portals (/portal/…), BYOD portals (/byod/…) |
Yes |
Certificate services (/scep/…, /ocsp…, /crl/…) |
Yes |
Site connector API (/edge/v1/…) |
Yes |
| RADIUS (UDP 1812/1813), RadSec (TCP 2083), TACACS+ (TCP 49) | No. They are not HTTP and keep their published ports. |
Before you begin
Section titled “Before you begin”- The Airgate Docker Compose deployment (
deploy/compose.yaml, settings indeploy/.env). In the commands below,C="docker compose -f deploy/compose.yaml --env-file deploy/.env". - A Cloudflare account with your domain (here
contoso.com) and access to Zero Trust. - The Airgate subnet prefix:
NAC_SUBNET_PREFIXindeploy/.env, default172.30.80. Airgate’s web listener is thenhttp://172.30.80.10:8090.
Step 1: Create the tunnel in Cloudflare
Section titled “Step 1: Create the tunnel in Cloudflare”- In the Cloudflare dashboard, open Zero Trust › Networks › Tunnels and select Create a tunnel.
- Choose Cloudflared, name the tunnel
airgate, and save. - On the install page, copy the token (the long value after
--tokenin the shown command). You do not need to install anything: the connector container is part of the Airgate deployment. - Add a Public hostname: Subdomain
airgate, Domaincontoso.com, Service typeHTTP, URL172.30.80.10:8090(your prefix +.10:8090). Save.
Step 2: Configure Airgate
Section titled “Step 2: Configure Airgate”-
In
deploy/.env, set:Terminal window CLOUDFLARE_TUNNEL_TOKEN=<token from Step 1>PUBLIC_URL=https://airgate.contoso.comPUBLIC_URLmust be the tunnel’s HTTPS address: Airgate uses it for the portal URLs, links and enrollment. -
Apply the new
PUBLIC_URLand start the connector:Terminal window $C up -d nacd$C --profile public up -d tunnel
The tunnel service runs cloudflare/cloudflared:2025.4.0 at the fixed
address <prefix>.30.
Client addresses
Section titled “Client addresses”Airgate believes the CF-Connecting-IP, X-Forwarded-For and
X-Forwarded-Proto headers only from TRUSTED_PROXIES, by default exactly
the two connector addresses (<prefix>.30 and <prefix>.31). Audit
records, sign-in records and per-address limits then show the real client,
and portals know the request arrived over HTTPS (secure cookies, absolute
URLs). The same headers from any other peer are ignored. Behind another
reverse proxy, add its address to TRUSTED_PROXIES (IPs or CIDRs, comma
separated).
Temporary URL for a demo
Section titled “Temporary URL for a demo”Without a Cloudflare account, start a quick tunnel:
$C --profile quick up -d tunnel-quick$C logs tunnel-quickThe log shows a random https://….trycloudflare.com address. It changes on
every start; do not use it for production.
Protect the console (optional)
Section titled “Protect the console (optional)”To restrict who can reach the console, put Cloudflare Access in front of
the host name. Keep these paths public, because guests, devices and site
connectors use them without a Cloudflare login: /portal/, /byod/,
/scep/, /ocsp, /crl/ and /edge/.
Verify
Section titled “Verify”- Open
https://airgate.contoso.com: the console sign-in page appears with a Cloudflare certificate. - In Cloudflare, the tunnel shows Healthy.
$C logs tunnelshows registered connections.- In the console, Settings › Audit log shows your real public IP for
your sign-in, not
172.30.80.30.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| Cloudflare error 1033 or the tunnel shows Down | The tunnel container is not running or the token is wrong. |
$C --profile public up -d tunnel; check CLOUDFLARE_TUNNEL_TOKEN. |
| Cloudflare error 502 | The public hostname points to the wrong address or port. | Use http://<prefix>.10:8090. |
| Portal links or enrollment use the old address | PUBLIC_URL was not updated or nacd not restarted. |
Set PUBLIC_URL and run $C up -d nacd. |
The audit log shows 172.30.80.30 as client |
The connector’s address is not in TRUSTED_PROXIES (custom prefix or proxy). |
Set TRUSTED_PROXIES to the connector addresses. |
| Switches cannot reach RADIUS | RADIUS does not go through the tunnel. | Publish UDP 1812/1813 (or RadSec TCP 2083) directly, or use a site connector. |