1. My Caddy version devel with very latest code since Apr 17 2020
2. How I run Caddy:
I’m playing with caddy as a reverse proxy server.
As you can find below my caddyfile: caddy will reverse round-robin to two upstream services on port 9010/9020.
the reverse proxy works very well until I stopped the service on 9010 port. caddy can successfully reverse to 9020 port. The problem is that after I brought back 9010 to work, caddy can not route the traffic to 9010, all traffic goes to 9020. I didn’t find any document how to make it work ?
I’ll need to dig into it a bit more to verify, but I think it’s because you’re not specifying any health checks for Caddy to detect that the backend is back up. Could you try enabling either active or passive health checks?
Hm, I suppose that might be possible – thanks for helping to troubleshoot this! I’ll be pretty busy this week, do you think you can drill down a little more to determine if that is the problem? Find a way to close the connection (it can be hacky just for your testing) and then see if it solves it?
In case I removed the if req.URL.Host == “” check in method directRequest of reverseproxy.go, then it will work as a charm. (will re-dial again).
The if check does not meet since it’s already set to localhost:9010, but the dial happens on 9020(which will re-use the http-keeplived cache connection).
We can patch this pretty quick after the 2.0 release here in a week or two. Doing it after 2.0 will ensure we don’t break anything right before 2.0, and then people using the latest will have time to help test before the 2.1 release.