[go: nahoru, domu]

Skip to content
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

Load balancer sticky cookie should have a Max-Age configuration #6393

Open
JasonYuan869 opened this issue Jun 13, 2024 · 4 comments
Open

Load balancer sticky cookie should have a Max-Age configuration #6393

JasonYuan869 opened this issue Jun 13, 2024 · 4 comments
Labels
feature ⚙️ New feature or request

Comments

@JasonYuan869
Copy link
Contributor
JasonYuan869 commented Jun 13, 2024

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!

@mholt
Copy link
Member
mholt commented Jun 13, 2024

Thanks for the issue. Do you have any suggestions as to what the config would look like for that?

@mholt mholt added the feature ⚙️ New feature or request label Jun 13, 2024
@JasonYuan869
Copy link
Contributor Author

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.

@mholt
Copy link
Member
mholt commented Jun 13, 2024

That LGTM. Want to submit a PR? 😃

@mohammed90
Copy link
Member

Consider using caddy.Duration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ⚙️ New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants