-
Notifications
You must be signed in to change notification settings - Fork 186
Closed
Labels
Description
See discussion in #23
This could be addressed by implementing Middleware which uses a custom ResponseWriter to intercept HTTP Responses, save the session data to the store and set the session cookie - similar to v0.1 of SCS (https://github.com/alexedwards/scs/blob/v0.1.0/session/manager.go)
Downside is that this causes problems with frameworks/applications which also try to call WriteHeader. See #15
A workaround might be to set the session cookie header each time the session is modified (or even loaded) and only handle saving to the store in the middleware. I think that would work for most stores, except the CookieStore, which needs the response headers to not have already been written.
mvrhov