OPNsense Forum

English Forums => Virtual private networks => Topic started by: peterkal on April 15, 2025, 03:04:58 PM

Title: Expose WireGuard over port 443 (HTTPS) with HAProxy, Cloudflare, and SSL certs?
Post by: peterkal on April 15, 2025, 03:04:58 PM
Hello everyone,

I'm running an OPNsense setup and looking for a way to make my WireGuard server accessible via port 443 (HTTPS), especially for use in restricted networks that block UDP/51820 or use DPI.

My current setup:
The problem: On some restrictive networks (corporate, public WiFi, mobile data), UDP/51820 is blocked or filtered. This causes the WireGuard handshake to fail, and I cannot connect at all.

Since port 443 is usually open in most networks, I want to:
Challenges:
HAProxy cannot bind both HTTPS (TCP) and raw TCP (or UDP) on the same port 443

WireGuard itself doesn't support TCP, and Cloudflare proxy doesn't support UDP

I'd prefer to avoid breaking my HTTPS websites behind HAProxy

Ideas I've considered:
But I couldn't find a clear guide that works cleanly with:
My questions:
Thanks in advance for any advice, working configs, or alternative ideas!
Title: Re: Expose WireGuard over port 443 (HTTPS) with HAProxy, Cloudflare, and SSL certs?
Post by: Monviech (Cedrik) on April 15, 2025, 04:24:42 PM
Wireguard is UDP by design so you cannot wrap it into TCP with a proxy inbetween.

If you need TCP 443 rather use OpenVPN for multiplexing.

You can do many multiplexing use-cases in caddy:

https://docs.opnsense.org/manual/how-tos/caddy.html#layer-7-matchers