Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ func NewProxyManager(dispatcher *dispatcher.Dispatcher, gptClient *gptscript.GPT
func (pm *Manager) AuthenticateRequest(req *http.Request) (*authenticator.Response, bool, error) {
// Check for the access token cookie.
// This authenticator requires the cookie in order to authenticate any users.
if _, err := req.Cookie(ObotAccessTokenCookie); errors.Is(err, http.ErrNoCookie) {
return nil, false, nil
// When sessions exceed 4KB, oauth2-proxy splits them into multiple cookies (_0, _1, _2, etc.)
// so we check for either the base cookie or the _0 cookie.
_, err := req.Cookie(ObotAccessTokenCookie)
if errors.Is(err, http.ErrNoCookie) {
// Try the _0 cookie for multi-cookie sessions
if _, err := req.Cookie(ObotAccessTokenCookieZero); errors.Is(err, http.ErrNoCookie) {
return nil, false, nil
}
}

configuredProvider, err := pm.dispatcher.GetConfiguredAuthProvider(req.Context())
Expand Down