Sticky Sessions?

Apologies for my lack of knowledge. I’m looking to place CaddyServer in front of a few webservers to provide load balancing and SSL termination. How can I instruct CaddyServer to use Sticky Sessions?

If you’re using Caddy v2, you can use the lb_policy option for the reverse_proxy directive. See here: reverse_proxy (Caddyfile directive) — Caddy Documentation

If you’re using Caddy v1, then it’s the policy option for the proxy directive.

I tried lb_policy with most of the different options when testing v2 a few weeks ago. When I had a single website running behind Caddy, everything worked fine. But, when I added a second instance, my web apps no longer worked. I assumed that CaddyServer was not keeping clients connected to the same server. At least that is what it seemed like.

So, are you telling me that all of the lb_policy options direct a client’s requests to the same backend web or application server for the duration of a “session”?

Depending on your setup, I think the lb_policy you need is ip_hash. If you used reverse_proxy without specifying a policy, Caddy defaults to random.

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