diff --git a/roundrobin/stickysessions.go b/roundrobin/stickysessions.go index 57f6f855..c9013b6b 100644 --- a/roundrobin/stickysessions.go +++ b/roundrobin/stickysessions.go @@ -13,8 +13,8 @@ type StickySession struct { // CookieOptions has all the options one would like to set on the affinity cookie type CookieOptions struct { - httpOnly bool - secure bool + HTTPOnly bool + Secure bool } // NewStickySession creates a new StickySession @@ -53,7 +53,7 @@ func (s *StickySession) GetBackend(req *http.Request, servers []*url.URL) (*url. // StickBackend creates and sets the cookie func (s *StickySession) StickBackend(backend *url.URL, w *http.ResponseWriter) { opt := s.options - cookie := &http.Cookie{Name: s.cookieName, Value: backend.String(), Path: "/", HttpOnly: opt.httpOnly, Secure: opt.secure} + cookie := &http.Cookie{Name: s.cookieName, Value: backend.String(), Path: "/", HttpOnly: opt.HTTPOnly, Secure: opt.Secure} http.SetCookie(*w, cookie) } diff --git a/roundrobin/stickysessions_test.go b/roundrobin/stickysessions_test.go index bca51232..d1ecd289 100644 --- a/roundrobin/stickysessions_test.go +++ b/roundrobin/stickysessions_test.go @@ -96,7 +96,7 @@ func TestStickCookieWithOptions(t *testing.T) { fwd, err := forward.New() require.NoError(t, err) - options := CookieOptions{httpOnly: true, secure: true} + options := CookieOptions{HTTPOnly: true, Secure: true} sticky := NewStickySessionWithOptions("test", options) require.NotNil(t, sticky)