Code

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#7264 closed (worksforme)

Cookies not be set for IE6, IE7 and Safari.

Reported by: sethtrain Owned by: nobody
Component: contrib.sessions Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When using session variables the corresponding session cookies aren't being set in IE6, 7 and Safari when application is on production server. This doesn't happen when the application is ran from the Django development server. I have tried setting SESSION_COOKIE_DOMAIN and that didn't work and now I am butting my head to figure out what is going on. Firefox works on production server just fine.

I have running Ubuntu 7.10 with Apache 2.2 and mod_wsgi 1.3 if that helps any. I do not have PHP enabled. At this point I am willing to share any of my code to figure this out. The Admin doesn't work and I have a piece of code that gets or sets a session id for a cart if it exists. I do this when adding items to the cart or displaying the cart in any way. Adding and item to the cart works just fine but when trying to go to the cart page and displaying that same cart I get an empty cart. Here is my get cart method.

    @classmethod
    def get_session_cart(cls, request, customer=None):
        try:
            cart = cls.objects.get(pk=request.session.get('cart', ''))
        except Cart.DoesNotExist:
            cart = cls()
            cart.customer = customer
            cart.save()
            request.session['cart'] = cart.id
        return cart

So the session cookies aren't being saved and Django creates a new session every time I run this method.

Attachments (0)

Change History (3)

comment:1 Changed 6 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

If the cookie mechanism really didn't work in these browsers, we'd be flooded with huge numbers of bug reports, so it must be something about your setup. This isn't really the place for questions about that, though, so head over to the django-users mailing list.

comment:2 Changed 6 years ago by zgoda

My best guess, there is something related to cross-domain cookies. I saw this problem with my app in IE6 (it sets a cookie for *.domain, then tries to read it in subdomain.domain). This problem suddenly vanishes and reappears and I am unable to detect the reason for this weird behaviour.
I second ubernostrum in closing this ticket, as this is hardly reproductible under any circumstances (at least I was unable to trace it).

comment:3 Changed 6 years ago by sethtrain

Just so everyone knows, this wasn't a Django problem. It was because I had a underscore ("_") in my sub-domain. Thanks ubernostrum for pointing me away from Django otherwise I would have never figured it out.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.