-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about load balancing #5486
Comments
|
No, you need to specifically use the That Something I've been considering is making the secondary policy configurable. Currently, most policies just do |
But the only supported HMAC hashing is 256 and not 512, my backend uses sha512 not 256 i read from the docs that it will do set cookie when theree was no cookie present. The only thing i want is upstream a session when it is present not to set a session cookie when it was not present
|
That's not a supported usecase currently. We could probably make that an option, i.e.
Keep in mind that the contents of the hash need to be a precise value, i.e. the upstream address as known by Caddy. You can't use just any session cookie for this. So for that reason, the hashing algorithm Caddy uses doesn't need to match the algorithm your backend uses for sessions. Instead, your backend should use the same hashing algorithm as Caddy for the sticky cookie. To clarify, you would need to use a second cookie for this, your session cookie can't be reused.
No, fallback functionality doesn't exist yet. |
To explain further, the reason your session cookie can't be reused is that this would mean Caddy would need to store in memory the list of all the sessions it has ever seen as a mapping to the upstream we proxied it to. That would use way too much memory. The I'm not convinced a |
Can wee see in future that we can choose whether caddy uses sha256 or sha512 to compute the cookie hash, bcs atm only sha256 from what i see, and thnx for the help tbh |
I don't see any reason to make the hashing algorithm customizable. As I said, the cookie value only makes sense to be controlled by Caddy. But if you wanted to force a specific upstream... if you can compute a sha512 hash, you can also compute a sha256 hash. |
Oke thnx |
Implemented |
damn, thanks <3 |
So what I am wanting is to load balance with least conn algorithm. But while doing so, I do not want my client to lose his session details as the flow of my app continues. So for that, is it right to use header up to set the session cookie? Look at the example below
flow:
client server request -> backend pick least conn server -> pass cookie header when it is present to uplink server stream -> server receives request
The text was updated successfully, but these errors were encountered: