Panel behind Cloudflare or your own proxy
The panel can sit behind Cloudflare or another reverse proxy that holds the certificate. Clients and browsers then see the proxy’s HTTPS; the panel must trust the proxy’s forwarding headers and still know its public URL.
Before you start
Section titled “Before you start”- A domain pointing at the proxy.
- The panel reachable from the proxy on the port you choose (often localhost or a private address).
- You understand that join commands and subscription links must use the public https URL, not the inner listen address.
- Terminate TLS on Cloudflare (or your proxy) for the panel hostname.
- Proxy to the panel’s listen address and port (Settings → Panel, or the install defaults).
- Set Trusted proxies (
trusted_proxies) to the proxy addresses that may sendX-Forwarded-For/ forwarded proto, so login guard and logs see the real client address. Wrong values let clients spoof addresses or break bans. - Set the public URL / domain fields the panel uses for links and node join (HTTPS public URL). Bridges and exits need that https address to join (HTTPS, Iran bridges).
- Open only what the proxy needs toward the panel; do not publish the panel’s plain port on the internet if the proxy is the front door.
- Optional HSTS once you are sure HTTPS is permanent.
How to check it worked
Section titled “How to check it worked”Browser opens the panel on https without certificate warnings. sudo aftab status ready. A bridge install command shows https. Login guard bans the real client IP when tested.
If it does not
Section titled “If it does not”Redirect loops: forwarded proto not trusted. Wrong client IPs in the log: fix trusted_proxies. Nodes refuse to join: public URL is still http or inner-only. See Security.
What is not changed
Section titled “What is not changed”VPN UDP ports still terminate where WireGuard listens (panel or bridge), not on Cloudflare’s HTTP proxy. Do not put WireGuard UDP through an HTTP-only CDN.