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

Cookie deletion does not properly set the domain #65

Closed
flowerseses opened this issue Sep 26, 2023 · 0 comments
Closed

Cookie deletion does not properly set the domain #65

flowerseses opened this issue Sep 26, 2023 · 0 comments

Comments

@flowerseses
Copy link
Contributor

So, in using starsessions for a project, I've run into an issue - while running everything on localhost, the library behaves perfectly. However, as soon as I put it in a docker container, behind a reverse proxy, or even try to deploy it, calling
request.session.clear() seems to not set cookie_domain for the cookie that's being deleted. So, in effect, the old cookie remains unchanged, while the session is deleted in the backend, and a new cookie for localhost is set with the right expiry and session id and everything.

The issue happens here:

headers = MutableHeaders(scope=message)
header_value = "{}={}; {}".format(
self.cookie_name,
f"null; path={path}; expires=Thu, 01 Jan 1970 00:00:00 GMT;",
self.security_flags,
)
headers.append("Set-Cookie", header_value)

I might be misunderstanding something, however, but if this is an actual issue, I'll attach a PR suggestion to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant