-
-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand session cookie configuration #190
Comments
Exposing the |
A solution to work around the issue is to redirect with a 200 which can be done like so: let redirect_200 url =
let html =
Printf.sprintf
{|<html><head><meta http-equiv="refresh" content="0;URL='%s'"/></head><body><p>Moved to <a href="%s">%s</a>.</p></body></html>|}
url url url
in
Dream.html html This worked for my OIDC scenario at least, not sure if it's too hacky or not, but at least it works. |
The above commit changes the default for Dream's cookies from I think that solves the underlying issue here. Please comment, though, if you think the session middleware does need more configuration options for any other reason! |
It appears that the default of
SameSite=Strict
results in cookies that are sent as part of a redirection response (either 303 or 302) not being retained or sent by the browser afterwards; settingSameSite=Lax
yields expected behavior. (There are some other workarounds described in https://stackoverflow.com/questions/42216700, FWIW.)It seems reasonable to suspect that there are a variety of contexts where the various session implementations using
Cookie.set_cookie
's defaults will be inappropriate. Rather than suggest a narrow addition ofSameSite
configurability to address the above specific issue, maybe it is more reasonable to expose all ofset_cookie
's options via each of the session middlewares?(Maybe this is just another bullet point for #13.)
The text was updated successfully, but these errors were encountered: