msmart
msmart

Reputation: 306

Changing Cookie header value at every request in Django

Somehow the values for in the Cookie change at every request.

As I'm using the auth and session middleware (which add the Vary: Cookie header). I'm not able to cache the pages.

Any hints how I can change this behaviour?

Upvotes: 1

Views: 770

Answers (3)

Anentropic
Anentropic

Reputation: 33863

As @msmart found, this is an annoying effect of Google Analytics and a bit of a problem with the vary-on-cookie pattern (you can't specify which cookies you want to vary on)

There is a bug for Django here:
https://code.djangoproject.com/ticket/9249
which has a patch for Django.

This will let you get your Django-side caching behaviour working again, but http proxy caches will still fail to cache pages due to the changing cookies.

Upvotes: 1

msmart
msmart

Reputation: 306

Sorry, this has nothing todo with django.

The changing cookie values were caused by the google analytics tracker.

This made the standard chache_site mechanism impossible.

Upvotes: 1

imjoevasquez
imjoevasquez

Reputation: 14381

what are you using for the session backend?

see: http://docs.djangoproject.com/en/dev/topics/http/sessions/#configuring-the-session-engine

whoops...should have been a comment...not an answer...

Upvotes: 0

Related Questions