Skip to content

Commit 5225e6d

Browse files
authored
fix: always delete rpc cookie (#558)
1 parent 3e09eaa commit 5225e6d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

server/internal/middleware/session.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package middleware
22

33
import (
44
"net/http"
5+
"strings"
56

67
"github.com/speakeasy-api/gram/server/internal/contextvalues"
78
)
@@ -13,6 +14,16 @@ func SessionMiddleware(next http.Handler) http.Handler {
1314
ctx := contextvalues.SetSessionTokenInContext(r.Context(), cookie.Value)
1415
r = r.WithContext(ctx)
1516
}
17+
if strings.HasSuffix(r.URL.Path, "rpc/auth.info") {
18+
http.SetCookie(w, &http.Cookie{
19+
Name: "gram_session",
20+
Value: "",
21+
MaxAge: -1,
22+
Path: "/rpc",
23+
HttpOnly: true,
24+
Secure: true,
25+
})
26+
}
1627
next.ServeHTTP(w, r)
1728
})
1829
}

0 commit comments

Comments
 (0)