1. The problem I’m having:
I am trying set up a primary/secondary failover server system using Caddy, where the Servers and Clients are connecting using signalr, Caddy is then listening to the /status health_uri to determin if the servers are active or not, by checking the response body.
The problem:
If i have the primary and secondary servers running and active, then connect a client to the Caddy server. The connection is then of course routed to the primary server, like it should be.
But if i now change the primary server to be innactive, Caddy is still connecting the client to the innactive primary server. Even though Caddy has marked the primary server as unhealty and all new connections gets routed to the seccondary server.
Is this how it is supposed to work? And is there a way to work around this, like some way to close connections to an unhealthy server?
2. Error messages and/or full log output:
This is what gets printed int the console when Caddy checks the health of the unhealthy primary server
2023/09/06 14:15:38.753 ←[34mINFO←[0m http.handlers.reverse_proxy.health_checker.active response body failed expectations {"host": "localhost:55167"}
3. Caddy version:
2.7.4
4. How I installed and ran Caddy:
a. System environment:
I am running everything on windows 10 and i downloaded caddy_2.7.4_windows_arm64.zip
from the release on github
b. Command:
I used cd to get into where i uziped the folder then ran
caddy run --config Caddyfile
c. Service/unit/compose file:
d. My complete Caddy config:
:2015
reverse_proxy * {
to localhost:55167
to localhost:5500
lb_policy first
lb_try_duration 5s
lb_try_interval 250ms
health_uri /status
health_interval 10s
health_timeout 2s
health_status 200
health_body "Active"
}