Ip_hash failover?

1. The problem I’m having:

I’m trying to load balance. Regarding the ip_hash policy, if one backend fails, does caddy automatically switch to an alternative backend?

It seems that it doesn’t in my tests. Is there a way to enable this functionality? Thank you.

2. Error messages and/or full log output:

Example config below. In another example, I added unhealthy_status 429, but the failover seems to not work neither.

	reverse_proxy {
		to a:123
		to b:123
		to c:123
		lb_policy ip_hash
		lb_try_duration 5s
		lb_try_interval 1s
		fail_duration 30s
		max_fails 3

3. Caddy version:


4. How I installed and ran Caddy:

a. System environment:

Docker on Debian ARM64

b. Command:

Docker compose up

c. Service/unit/compose file:


d. My complete Caddy config:


5. Links to relevant resources:

Please try v2.7.5 which we’ve released this week, it might fix the behaviour you’re seeing.

Thanks. I tried the new version, and the issue persists.

It seems that when the policy is ip_hash, failover is not enabled at all. Should I open an issue about this feature?

Enable the debug global option and show your logs. It should show the upstream selection logic.

1 Like

Thank you. I think the problem is that the failover is not enabled for existing visitors (who have an assigned load balancer already)

I’m not sure what you mean. Please show your logs, etc.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.