From bd357bf00507d0f81c8c401b1ffa7ccb1f7c00bf Mon Sep 17 00:00:00 2001 From: Dimitri Masson <30894448+d-masson@users.noreply.github.com> Date: Tue, 30 Mar 2021 23:29:00 +0200 Subject: [PATCH] reverseproxy: Set cookie path to `/` when using cookie lb_policy (#4096) --- modules/caddyhttp/reverseproxy/selectionpolicies.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/caddyhttp/reverseproxy/selectionpolicies.go b/modules/caddyhttp/reverseproxy/selectionpolicies.go index dacfd118..357ee33a 100644 --- a/modules/caddyhttp/reverseproxy/selectionpolicies.go +++ b/modules/caddyhttp/reverseproxy/selectionpolicies.go @@ -445,7 +445,7 @@ func selectNewHostWithCookieHashSelection(pool []*Upstream, w http.ResponseWrite sha, err := hashCookie(cookieSecret, randomHost.Dial) if err == nil { // write the cookie. - http.SetCookie(w, &http.Cookie{Name: cookieName, Value: sha, Secure: false}) + http.SetCookie(w, &http.Cookie{Name: cookieName, Value: sha, Path: "/", Secure: false}) } } return randomHost