Support setting sticky cookie max age
This commit is contained in:
parent
64ff214ff8
commit
0eeb85d01d
21 changed files with 187 additions and 0 deletions
|
@ -25,6 +25,7 @@ type stickyCookie struct {
|
|||
secure bool
|
||||
httpOnly bool
|
||||
sameSite string
|
||||
maxAge int
|
||||
}
|
||||
|
||||
func convertSameSite(sameSite string) http.SameSite {
|
||||
|
@ -77,6 +78,7 @@ func New(sticky *dynamic.Sticky, wantHealthCheck bool) *Balancer {
|
|||
secure: sticky.Cookie.Secure,
|
||||
httpOnly: sticky.Cookie.HTTPOnly,
|
||||
sameSite: sticky.Cookie.SameSite,
|
||||
maxAge: sticky.Cookie.MaxAge,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,6 +240,7 @@ func (b *Balancer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||
HttpOnly: b.stickyCookie.httpOnly,
|
||||
Secure: b.stickyCookie.secure,
|
||||
SameSite: convertSameSite(b.stickyCookie.sameSite),
|
||||
MaxAge: b.stickyCookie.maxAge,
|
||||
}
|
||||
http.SetCookie(w, cookie)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue