1. The problem I’m having:
I would like to reverse proxy to a host by using its name from DNS, but only connect over IPv4, not IPv6. The host has both. However, access logs on the remote service show Caddy is connecting via IPv6.
I expected that using a dynamic a
block with versions ipv4
set within reverse_proxy
would achieve this, but caddy is still discovering and using an IPv6 address.
2. Error messages and/or full log output:
2024/07/03 10:46:12.362 DEBUG http.reverse_proxy.upstreams.a refreshing A upstreams {"version": "ip", "name": "potoroo", "port": "8123"}
2024/07/03 10:46:12.363 DEBUG http.reverse_proxy.upstreams.a discovered A record {"ip": "xxxx:xxxx:8c5e:42:3ac9:86ff:fe40:8637"}
2024/07/03 10:46:12.363 DEBUG http.reverse_proxy.upstreams.a discovered A record {"ip": "xxxx:xxxx:8c5e:42::18"}
2024/07/03 10:46:12.363 DEBUG http.reverse_proxy.upstreams.a discovered A record {"ip": "192.168.42.18"}
2024/07/03 10:46:12.363 DEBUG http.reverse_proxy.upstreams.a discovered A record {"ip": "fd5d:61f5:a84a:42::18"}
2024/07/03 10:46:12.363 DEBUG http.reverse_proxy.upstreams.a discovered A record {"ip": "fd5d:61f5:a84a:42:3ac9:86ff:fe40:8637"}
2024/07/03 10:46:12.363 DEBUG http.handlers.reverse_proxy provisioned dynamic upstreams {"count": 5}
2024/07/03 10:46:12.363 DEBUG http.handlers.reverse_proxy selected upstream {"dial": "[fd5d:61f5:a84a:42:3ac9:86ff:fe40:8637]:8123", "total_upstreams": 5}
3. Caddy version:
v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=
4. How I installed and ran Caddy:
Installed with xcaddy build
. Start with caddy run
.
a. System environment:
Debian 12 on amd64. Not running in Docker / systemd.
b. Command:
caddy run
d. My complete Caddy config:
{
debug
}
:9000 {
reverse_proxy {
dynamic a potoroo 8123 {
versions ipv4
}
}
}