-
-
Notifications
You must be signed in to change notification settings - Fork 932
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
Starlette 0.15.0 breaks SessionMiddleware by adding ASGI Path for Subroutes using Mount #1261
Comments
I was able to reproduce this issue in a notebook: tinnable.com/tins/11ccfe75-e709-47ee-b085-f1755e844bef. |
I bumped into this myself as well. Taking a look… |
Hi all, |
Hello everyone, |
#1351 already created and waiting for feedback. |
Alright. After another look at this we've got this... #1512 |
Checklist
master
.Describe the bug
As discussed with @mahmoudhossam on #1147, I am creating this issue.
Update 0.15.0 broke my session checking function to ensure users are logged in. I mount all the sub routes (users, etc..). The request.session has data in it when set, but when I redirect back to the start page then session is now null. I see no documentation on how to have the session across Mounts?
Below is example of what I am doing...
To reproduce
Create basic app, using greater than 0.14.2, using Mount add subroutes and then check the session cookies for the subroutes as there will be a new session cookie as it it now acting like a submounted app, instead of subroutes.
Expected behavior
Mounts should not create a new session cookie, unless Mounting a sub application. See Routing and using Mounts in the documentation. It shows you need to add "app=" for the submounted app. If left out/none, it is just a submounted route and should not be treated as an submounted app.
Mount("/static", app=StaticFiles(directory="static"), name="static")
Actual behavior
Using Mount it will create new session cookies.
Debugging material
Environment
Additional context
I would suggest checking if in Mount app=None as a way to determine whether to use ASGI path or "/".
The text was updated successfully, but these errors were encountered: