Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django sessions not working in Internet Explorer

Sessions work perfectly in all other browsers that I have tested.

If I try to get the session id with sessionid = request.COOKIES['sessionid'], I get this error: KeyError: 'sessionid'

This is what I have in my settings.py:

CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
SESSION_COOKIE_DOMAIN = '.vb.is'
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'

Sites are vb.is, fiskifrettir.vb.is and hestabladid.vb.is

alt text

Server setup is: apache2 (mod_wsgi) and nginx

like image 306
demux Avatar asked Oct 14 '22 18:10

demux


1 Answers

Setting a cookie on XX.XX won't work in general. See Q#6 here: http://blogs.msdn.com/b/ieinternals/archive/2009/08/20/wininet-ie-cookie-internals-faq.aspx and see http://blogs.msdn.com/b/ieinternals/archive/2009/09/19/private-domain-names-and-public-suffixes-in-internet-explorer.aspx.

You can avoid the problem by setting the cookie with domain=WWW.vb.is instead.

like image 97
EricLaw Avatar answered Oct 30 '22 20:10

EricLaw