I’m trying to configure Caddy v2 on a server sitting behind a NAT which forwards port 443 to it.
Problem is, if I try to get automatic HTTPs to work by just saying “listen”: [“my.domain:443”] the server tries to bind to the IP of the router (and fails).
Is there a way to separate the “bind to this port” and the “use this domain” parts of the config?
Hey @gigaroby – absolutely; you want a host matcher. So just use “:443” as your listen address, then specify the host matcher with "example.com" (or whatever) in it.
Or the equivalent Caddyfile:
example.com
If you run caddy adapt on that, you’ll see what I mean.