Skip to content
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

SessionMiddleware uses an explicit path=..., instead of defaulting to the ASGI 'root_path'. #1512

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

tomchristie
Copy link
Member

@tomchristie tomchristie commented Feb 14, 2022

Closes #1261

This pull request reverts #1147.

I'd obviously made the wrong call on that.

The intent was "okay, let's limit the path against which session cookies are applied. Our server might be submounted to a given path, and we shouldn't cookie to / in that case." - Which is reasonable enough idea if it only applied to where the main app was mounted, but as it happens actually just breaks all sorts of cases for us. Because we allow for submounted apps too.

Instead we support a configurable path="/" on SessionMiddleware. This doesn't magically pick up any root path that the server might be mounted to, but does allow users to configure the path if they need too.

Also refs #233, #1351.

Prompted by this discussion.

@tomchristie tomchristie requested a review from a team February 14, 2022 12:58
@tomchristie tomchristie added bug Something isn't working feature New feature or request and removed feature New feature or request labels Feb 14, 2022
Copy link
Member

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tomchristie tomchristie merged commit 62428c5 into master Feb 14, 2022
@tomchristie tomchristie deleted the explicit-path-for-session-middleware branch February 14, 2022 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Starlette 0.15.0 breaks SessionMiddleware by adding ASGI Path for Subroutes using Mount
2 participants