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

Support cookie hash #1132

Merged
merged 2 commits into from Nov 9, 2023
Merged

Support cookie hash #1132

merged 2 commits into from Nov 9, 2023

Conversation

xxx7xxxx
Copy link
Contributor

@xxx7xxxx xxx7xxxx commented Nov 7, 2023

Fix #368

@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2023

Codecov Report

Attention: 37 lines in your changes are missing coverage. Please review.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files Coverage Δ
pkg/filters/proxies/loadbalance.go 84.50% <0.00%> (-1.21%) ⬇️
pkg/filters/redirectorv2/redirectorv2.go 63.55% <65.34%> (ø)

... and 7 files with indirect coverage changes

📢 Thoughts on this report? Let us know!

Comment on lines 114 to 115
case LoadBalancePolicyCookieHash:
lbp = &HeaderHashLoadBalancePolicy{spec: &LoadBalanceSpec{HeaderHashKey: "Set-Cookie"}}
Copy link
Contributor

@suchen-sci suchen-sci Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set-Cookie is in response header that server send to client. In this place, client sends requests to server. I think maybe Cookie header is more appropriate.

As show in https://docs.oracle.com/en-us/iaas/Content/Balance/Reference/sessionpersistence.htm#cook__HowItWorks

The Load Balancer service calculates a hash of the configured cookie and other request parameters, 
and sends that value to the client in a cookie. 
The value stored in the cookie enables the service to route subsequent client requests to the correct backend server. 
If your backend servers change any of the defined cookies, 
the service recomputes the cookie's value and resends it to the client.

My understand for this is that load balancer use Set-Cookie header to set some information to client. And in later requests, get this information from Cookie header and use this information to route to correct server?

And for cookie hash, do we support to route based on a specific cookie or route based on all cookies? When use header.Get(), it is always return first cookie...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@suchen-sci suchen-sci added this pull request to the merge queue Nov 9, 2023
Merged via the queue into easegress-io:main with commit bb9e904 Nov 9, 2023
8 checks passed
@xxx7xxxx xxx7xxxx deleted the cookie-hash branch November 10, 2023 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Load balancing by cookie
3 participants