Skip to content

Commit

Permalink
Fixes Console issue #400 (#401)
Browse files Browse the repository at this point in the history
Previously cookie path was set to Path="/api", this was a performance
improvement to tell the browser to send the cookie only to request with
that prefix, however also consume endpoints on Path="/ws", since rfc6265
doesnt support multiple paths or regular expressions in the path field
of a cookie we are back to use Path="/" which means send the cookie to
all request under the current domain.

Co-authored-by: Daniel Valdivia <hola@danielvaldivia.com>
  • Loading branch information
Alevsk and dvaldivia committed Nov 18, 2020
1 parent 761c652 commit f1db949
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions restapi/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func NewSessionCookieForConsole(token string) http.Cookie {
expiration := time.Now().Add(SessionDuration)

return http.Cookie{
Path: "/api", // browser will send cookie only for HTTP request under api path
Path: "/",
Name: "token",
Value: token,
MaxAge: int(SessionDuration.Seconds()), // 45 minutes
Expand All @@ -125,7 +125,7 @@ func NewSessionCookieForConsole(token string) http.Cookie {

func ExpireSessionCookie() http.Cookie {
return http.Cookie{
Path: "/api", // browser will send cookie only for HTTP request under api path
Path: "/",
Name: "token",
Value: "",
MaxAge: -1,
Expand Down

0 comments on commit f1db949

Please sign in to comment.