#23939: SessionAuthenticationMiddleware causes "Vary: Cookie" header no matter
what
------------------------------+--------------------------------------
Reporter: andrewbadr | Owner: nobody
Type: Bug | Status: new
Component: contrib.auth | Version: 1.7
Severity: Normal | Resolution:
Keywords: cookies | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by andrewbadr):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> Setting a "Vary: Cookie" header when unnecessary is bad for reasons
> described in e.g. #3586, #6552. It seems that the recently-introduced and
> on-by-default SessionAuthenticationMiddleware causes this header to
> always be set. This seems to be caused by the `hasattr(user,
> 'get_session_auth_hash')` check here:
> https://github.com/django/django/blob/1.7.1/django/contrib/auth/middleware.py#L34.
>
> To reproduce: start a new empty project with django-admin.py, request the
> index page, and see that the Vary: Cookie header is present. Commenting-
> out the middleware's line in settings.py causes the header to no longer
> be sent.
>
> It might be good to add a test verifying that the above steps never set a
> Vary: Cookie header.
New description:
Setting a "Vary: Cookie" header when unnecessary is bad for reasons
described in e.g. #3586, #6552. It seems that the recently-introduced and
on-by-default SessionAuthenticationMiddleware causes this header to always
be set. This seems to be caused by the `hasattr(user,
'get_session_auth_hash')` check here:
https://github.com/django/django/blob/1.7.1/django/contrib/auth/middleware.py#L34.
To reproduce: start a new empty project with django-admin.py, request the
index page, and see that the Vary: Cookie header is present. Commenting-
out the middleware's line in settings.py causes the header to disappear.
It might be good to add a general test case verifying that the above steps
never set a Vary: Cookie header.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/23939#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.740c563d8151bf9c195e73e248f69563%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.