caddy
caddy copied to clipboard
Load balancer sticky cookie should have a Max-Age configuration
I have a service routed with the following
reverse_proxy backend-blue:3000 backend-green:3000 {
lb_policy cookie {
fallback first
}
}
This allows me to do zero-downtime upgrades on a stateful service by switching the order of the upstreams.
I think it would be useful to allow configuration of a Max-Age property for the cookie to ensure that eventually a client application will use the new backend when the cookie expires.
If this is a feature that seems appropriate for the project, I would love to help contribute!
Thanks for the issue. Do you have any suggestions as to what the config would look like for that?
Perhaps something like this?
reverse_proxy backend-blue:3000 backend-green:3000 {
lb_policy cookie {
fallback first
max_age 3600 # 1 hour
}
}
It definitely makes more sense to use Max-Age over Expires since we're not trying to hardcode a specific expiration time but rather tell the cookie to refresh after X duration.
That LGTM. Want to submit a PR? :smiley:
Consider using caddy.Duration