The backend is listening on IPv6 only (:::8081), but nginx is trying to connect via IPv4.
# Check if backend responds on IPv4 loopback
curl -v --ipv4 http://127.0.0.1:8081/healthExpected: Connection refused or timeout
# Check if backend responds on IPv6 loopback
curl -v --ipv6 http://[::1]:8081/healthExpected: Should return "OK" β
# Test what nginx is doing
curl -v http://localhost:8080/api/v1/settings/auditExpected: 502 Bad Gateway (current issue)
Try forcing the backend to listen on IPv4:
# Kill the current backend (it will restart)
pkill cased-backend
# Wait for restart, then check binding again
sleep 3
netstat -tlnp | grep 8081# Check if we can reach backend via IPv6 localhost
curl http://[::1]:8081/healthExpected: Should return "OK"
If IPv6 works ([::1]:8081) but IPv4 doesn't (127.0.0.1:8081), then we need to:
Either:
- Make backend bind to
0.0.0.0:8081(IPv4) explicitly - Make nginx use
[::1]:8081instead oflocalhost:8081 - Enable IPv6 in nginx resolver config
If you want to test if this fixes it immediately:
# Inside the pod, try accessing via IPv6 through nginx
# (This won't work directly, but confirms the issue)
# Check if curl can reach via IPv4 vs IPv6
curl --ipv4 -I http://localhost:8081/health
curl --ipv6 -I http://localhost:8081/healthIf IPv6 works and IPv4 doesn't, that's the smoking gun π«
- β
curl --ipv4 http://127.0.0.1:8081/healthfails - β
curl --ipv6 http://[::1]:8081/healthworks - β
curl http://localhost:8080/api/v1/settings/auditfails (502)
If all three match expectations above, the fix is confirmed and we should change the Go backend to bind explicitly to IPv4.