I would like to use Caddy to act as a reverse proxy that sits in front of an OpenVPN AS server. The initial connection for OpenVPN uses HTTPS, but then subsequent VPN traffic does not use HTTP and must be proxied as a TCP connection only.
I have a vanilla Ubuntu 20.04 installation and followed the installation instructions here. Caddy works fine for HTTP / HTTPS backends.
I believe correct way to run openvpn through Caddy is to use the layer4 module described here layer4 but i don’t know how to implement modules within my caddyfile, and don’t understand the documentation in the context of a broader caddyfile.
Assuming i’m correct, can someone please supply a complete end-to-end caddyfile example that shows how to
- Listen for connections to vpn.mydomain-.-com:443 -AND-
- Use the layer4 module and reverse proxy TCP connections to backend.mydomain-.-com:443
Thanks!