lucaslorentz / caddy-docker-proxy

Caddy as a reverse proxy for Docker
MIT License
2.86k stars 168 forks source link

sticky sessions #546

Closed devMls closed 9 months ago

devMls commented 10 months ago

Hi

I have a app in docker swarm wirh asp razor mvc

I publish It behind Caddy proxy wirh this olugin

The app is published as service wirh global replica arrond 3 node swarm cluster

I want use signalr that requires sticky sessiions

Is posible use Caddy for ensure a client goes always yo same node?

devMls commented 10 months ago

I find that use dnsrr IS a option wirh Caddy

With this aproach

https://caddy.community/t/load-balancing-problem-with-docker-dnsrr-mode/16316

But i don t know if this can be configured by this plugin

francislavoie commented 10 months ago

CDP is simply a mapping of labels to Caddyfile. So anything configurable in Caddyfile can be done with labels. Just read the README to understand the mapping.

That said, your post has lots of spelling issues, so I'm not sure I understand what you're asking for. You could use the cookie LB policy for sticky sessions https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#load-balancing

lucaslorentz commented 9 months ago

Multiple ways of doing sticky sessions. It could be based on cookies, headers, IP... I would advise first deciding how to achieve that using only Caddy and Caddyfile config, and then try to write the same config using Docker labels if you want to use this plugin. If you have issues writing your Caddyfile config using docker labels, feel free to open another issue and we can assist with that.