1. The problem I’m having:
Initially I only had a config without an explicit bind directive. Something just like following one:
bagspace.castle.mk {
reverse_proxy 10.89.1.35:8000
}
With this config caddy listened to both 80 and 443 ports.
Then I wanted to launch another site only for my internal network. So I just added a section:
http://cockpit.bagspace.vpn {
bind 192.168.51.1
reverse_proxy 127.0.0.1:9090
}
And after doing that caddy stopped listening to 80 port on an external interface. So as a result redirection from 80 to 443 port for site my.external.site
stopped working.
2. Error messages and/or full log output:
Before adding internal site I could see that caddy listens to all interfaces:
LISTEN 0 4096 *:80 *:* users:(("caddy",pid=1311048,fd=9))
LISTEN 0 4096 *:443 *:* users:(("caddy",pid=1311048,fd=7))
After modification caddy only listens to port 80 on the internal interface:
LISTEN 0 4096 *:443 *:* users:(("caddy",pid=1312400,fd=8))
LISTEN 0 4096 192.168.51.1:80 0.0.0.0:* users:(("caddy",pid=1312400,fd=7))
3. Caddy version:
I use caddy-docker-proxy
of version 2.8.8
run in a podman, but I also tried original caddy 2.7.4
that was run as systemd service.
4. How I installed and ran Caddy:
a. System environment:
NixOS 23.05
, amd64
b. Command:
c. Service/unit/compose file:
d. My complete Caddy config:
Initial config:
bagspace.castle.mk {
reverse_proxy 10.89.1.35:8000
}
The broken one:
bagspace.castle.mk {
reverse_proxy 10.89.1.35:8000
}
http://cockpit.bagspace.vpn {
bind 192.168.51.1
reverse_proxy 127.0.0.1:9090
}
And the fixed one:
http://bagspace.castle.mk {
redir https://bagspace.castle.mk
}
https://bagspace.castle.mk {
reverse_proxy 10.89.1.35:8000
}
http://cockpit.bagspace.vpn {
bind 192.168.51.1
reverse_proxy 127.0.0.1:9090
}