Re: optional middleware to eliminate cookies in request header

2017-01-06 Thread Tim Graham
It is a repost, let's use the first post: 
https://groups.google.com/d/msg/django-developers/4kwZP8Rq5IU/rQi5GgI6DgAJ

All first time posters go through a moderation queue.

On Friday, January 6, 2017 at 9:50:56 PM UTC-5, Jeff Willette wrote:
>
> I just posted this and I didn't see it pop up in the group, so I am sorry 
> if this is a repost. 
>
> I recently submitted a bad fix (
> https://code.djangoproject.com/ticket/27686#comment:6). I made a mistake 
> in thinking about how the caching system works but I think I have another 
> solution to the problem. 
>
> The solution in the ticket is good, but I would prefer to avoid another 
> request to get authed content and I would like to keep most of the logic in 
> django and continue to use the is_authenticated method. 
>
> What if there was a middleware early on in the request processing that 
> would match the cookie header by a regex in settings. If it did not find 
> one of the matches than it would eliminate the cookie header. This way the 
> vary by cookie header will still be sent, but inconsequential cookies will 
> be removed so that al unauthed users would have the same page cached 
> (varied by cookie with no cookies) and authed users would have theirs 
> cached correctly as well. 
>
> Is there anything wrong with my thinking about how this would work? Do you 
> think this is a good idea?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/6f67f844-7135-4c96-904a-d0447144835f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


optional middleware to eliminate cookies in request header

2017-01-06 Thread Jeff Willette
I just posted this and I didn't see it pop up in the group, so I am sorry 
if this is a repost. 

I recently submitted a bad fix 
(https://code.djangoproject.com/ticket/27686#comment:6). I made a mistake 
in thinking about how the caching system works but I think I have another 
solution to the problem. 

The solution in the ticket is good, but I would prefer to avoid another 
request to get authed content and I would like to keep most of the logic in 
django and continue to use the is_authenticated method. 

What if there was a middleware early on in the request processing that 
would match the cookie header by a regex in settings. If it did not find 
one of the matches than it would eliminate the cookie header. This way the 
vary by cookie header will still be sent, but inconsequential cookies will 
be removed so that al unauthed users would have the same page cached 
(varied by cookie with no cookies) and authed users would have theirs 
cached correctly as well. 

Is there anything wrong with my thinking about how this would work? Do you 
think this is a good idea?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/4fb1ca99-6144-40aa-b840-df514cefdcc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.