-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Affinity cookie not updated if invalid cookie is sent #3317
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
Comments
In found this PDF. After "Is there an upstream |
@joushx that PDF is not relevant anymore because we don't use nginx-sticky-module. We have Lua implementation (https://github.com/kubernetes/ingress-nginx/blob/master/rootfs/etc/nginx/lua/balancer/sticky.lua) and it's not as complete as the Nginx module. Currently there's no way to tell whether the cookie is invalid - Lua code needs some changes. |
Thank you. As we need this functionality, we switched to traefik in the meantime. |
/reopen |
@ElvinEfendi: Reopening this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@joushx if you don't mind I'd like to keep this issue open in case someone decides to address it. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Same problem with version 0.23.0: modified by user affinity cookie is not regenerated by nginx ingress.
Any plans to fix this bug? |
@efedunin Nginx will likely pick the new upstream, however it won't regenerate a new cookie (yes the documentation is not up-to-date). What's the bug here, the misleading documentation or the fact that Nginx does not recreate the cookie? |
@joushx can you help us understand why do you need to verify validity of the cookie? The sole purpose of cookie affinity is to steer clients to the same upstream (which happens) and if a user deliberately decides to change the cookie they might end up in a different upstream. |
Our problem is that upstream servers may become unavailable. In this case clients should be redirected to a different server. |
@joushx if an upstream server become unavailable then it will get removed from consistent hash ring and for the subsequent requests with same cookie there will be a different upstream chosen from the ring. In other words ingress-nginx implementation of cookie affinity does not store upstream address/id in the cookie, it stores a random unique key (per sticky client) that gets mapped to an available upstream using consistent hashing algorithm. So you will not run into the issue you describe. However note that we had an issue until version 0.23.0 where we were not refreshing the list of upstreams when an upstream is added or removed (became unavailable) which got fixed in #3809. So you can observe the incorrect behaviour you described in earlier versions but since |
Sorry for disturbance. I was confused by outdated docs. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/.):
No
What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.):
affinity, session, sticky, update, cookie
Is this a BUG REPORT or FEATURE REQUEST? (choose one):
BUG REPORT
NGINX Ingress controller version:
since 0.18.0
Kubernetes version (use
kubectl version
):Environment:
uname -a
): Linux Ubuntu-1604-xenial-64-minimal 4.15.0-33-generic Add nginx metrics to prometheus #36~16.04.1-Ubuntu SMP Wed Aug 15 17:21:05 UTC 2018 x86_64 x86_64 x86_64 GNU/LinuxWhat happened:
No Set-Cookie header is set
What you expected to happen:
Set-Cookie header with a hash
How to reproduce it (as minimally and precisely as possible):
Send a request with
Cookie: INGRESSCOOKIE=foobar
Anything else we need to know:
Worked until version 0.18.
0.18:
0.17.1:
The text was updated successfully, but these errors were encountered: