1. Caddy version (caddy version
):
V2.2.1
2. How I run Caddy:
On Ubuntu as service
a. System environment:
Ubuntu 20.04
b. Command:
runs from service default (installed using apt)
c. Service/unit/compose file:
default systemd
d. My complete Caddyfile or JSON config:
{
experimental_http3
admin :2019 {
origins localhost, 127.0.0.1, 192.168.17.100
}
}
# Add gzip compression to requests
(webconf) {
encode gzip
}
#define logging
(logging) {
log {
output file /var/log/caddy/caddy.log {
roll_size 1gb
roll_keep 5
}
}
}
#define wildcard certificate
(certs) {
tls /etc/caddy/STAR_eltomation_com.pem /etc/caddy/STAR_eltomation_com.key
}
# Add forward headers to requests
(theheaders) {
header_up X-Forwarded-Ssl on
header_up Host {http.request.host}
header_up X-Real-IP {http.request.remote}
header_up X-Forwarded-For {http.request.remote}
header_up X-Forwarded-Port {http.request.port}
header_up X-Forwarded-Proto {http.request.scheme}
header_up X-Url-Scheme {http.request.scheme}
header_up X-Forwarded-Host {http.request.host}
}
openvpn.eltomation.com {
import logging
import certs
reverse_proxy https://192.168.16.4 {
#import theheaders
transport http {
tls_insecure_skip_verify
}
}
import webconf
}
openvpn.eltomation.com:943 {
import logging
import certs
reverse_proxy https://192.168.16.4:943 {
#import theheaders
transport http {
tls_insecure_skip_verify
}
}
import webconf
}
openvpn.eltomation.com:1194 {
import logging
import certs
reverse_proxy https://192.168.16.4:1194 {
#import theheaders
transport http {
tls_insecure_skip_verify
}
}
import webconf
}
3. The problem I’m having:
OpenVPN can’t connect.
Opening the webbrowser does work, but it shows the IP of the reverse-proxy and not the WAN IP of the one connecting.
Enabling the import theheaders doesn’t make any difference.
4. Error messages and/or full log output:
5. What I already tried:
Tried adding the headers, and tried (as first step) to not add the headers.
Also tried to force the connection over only 443. Without Caddy this works, but when the connection needs to run over Caddy it doesn’t work.
To be clear, browsing the openvpn.eltomation.com website does work, but connecting to it using openvpn doesn’t.