aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/caddyhttp/reverseproxy/reverseproxy.go
diff options
context:
space:
mode:
authorDimitri Masson <[email protected]>2020-11-20 20:39:26 +0100
committerGitHub <[email protected]>2020-11-20 12:39:26 -0700
commit6e0849d4c2855375b66974f85eb9840d05197694 (patch)
treea4e15be164aec48cbc8f4d6c1c8254d33ff0d48e /modules/caddyhttp/reverseproxy/reverseproxy.go
parentb0d5c2c8ae076393e7a3ad59ce875027f4c29304 (diff)
downloadcaddy-6e0849d4c2855375b66974f85eb9840d05197694.tar.gz
caddy-6e0849d4c2855375b66974f85eb9840d05197694.zip
reverseproxy: Implement cookie hash selection policy (#3809)
* add CookieHashSelection for session affinity * add CookieHashSelection for session affinity * register module * reverse_proxy: Add and fix cookie lb_policy * reverse_proxy: Manage hmac.write error on cookie hash selection * reverse_proxy: fix some comments * reverse_proxy: variable `cookieValue` is inside the else block * reverse_proxy: Abstract duplicate nuanced logic of reservoir sampling into a function * reverse_proxy: Set a default secret is indeed useless * reverse_proxy: add configuration syntax for cookie lb_policy * reverse_proxy: doc typo and improvement Co-authored-by: utick <[email protected]>
Diffstat (limited to 'modules/caddyhttp/reverseproxy/reverseproxy.go')
-rw-r--r--modules/caddyhttp/reverseproxy/reverseproxy.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go
index 305a0b381..7fc61ae68 100644
--- a/modules/caddyhttp/reverseproxy/reverseproxy.go
+++ b/modules/caddyhttp/reverseproxy/reverseproxy.go
@@ -368,7 +368,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyht
var proxyErr error
for {
// choose an available upstream
- upstream := h.LoadBalancing.SelectionPolicy.Select(h.Upstreams, r)
+ upstream := h.LoadBalancing.SelectionPolicy.Select(h.Upstreams, r, w)
if upstream == nil {
if proxyErr == nil {
proxyErr = fmt.Errorf("no upstreams available")
@@ -816,7 +816,7 @@ type LoadBalancing struct {
// Selector selects an available upstream from the pool.
type Selector interface {
- Select(UpstreamPool, *http.Request) *Upstream
+ Select(UpstreamPool, *http.Request, http.ResponseWriter) *Upstream
}
// Hop-by-hop headers. These are removed when sent to the backend.