Skip to content

Comments

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

Merged
lovelydinosaur merged 1 commit intomasterfrom
explicit-path-for-session-middleware
Feb 14, 2022
Merged

SessionMiddleware uses an explicit path=..., instead of defaulting to the ASGI 'root_path'.#1512
lovelydinosaur merged 1 commit intomasterfrom
explicit-path-for-session-middleware

Conversation

@lovelydinosaur
Copy link
Contributor

@lovelydinosaur lovelydinosaur 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.

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

@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.

👍

@lovelydinosaur lovelydinosaur merged commit 62428c5 into master Feb 14, 2022
@lovelydinosaur lovelydinosaur 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