Internet Explorer ignoring my cookies

I am having a strange problem with Internet Explorer not accepting my cookies. This is the cookie:

set-cookie: USUSERNAME=LrceSVu6mUJ9Ztmvp4oKSQ%3D%3D; version="1"; expires=Mon, 15-Jun-2009 11:42:21 GMT; path=/; domain=.us.is

It does not get stored for the domain dev-intranet.us.is or any other us.is domain. However setting the domain of the cookie to my dev machines ip address works perfectly:

set-cookie: USUSERNAME=LrceSVu6mUJ9Ztmvp4oKSQ%3D%3D; version="1"; expires=Mon, 15-Jun-2009 08:41:58 GMT; path=/; domain=192.168.34.104

Everything works as expecten in Firefox, Opera, Safari and Chrome but not IE7

Any ideas whats going on here?

Btw. using WebObjects WOCookie to create the cookie.

Upvotes: 7

Views: 5872

Answers (2)

ebynum
ebynum

Reputation: 3534

Some additional edge cases / details (tests done in IE8 using the Per Site Privacy Actions [Internet Options > Privacy > Sites] ):

The following domains are REJECTED:

  a.a
 aa.a
  a.aa
 aa.aa

with the error message:

You have entered an invalid domain. Domains must be in the Internet zone
and must use the HTTP or HTTPS protocol. URLs beginning with xn-- must
be valid IDN names.

Examples of valid domains:

  - www.treyresearch.net
  - http://treyresearch.net
  - fineartschool.net

The following domains are ACCEPTED:

aaa.a
aaa.aa
  a.aaa
 aa.aaa

   a.a.a
  a.a.aa
 a.aa.aa
aa.aa.aa

Further, and largely unrelated, Internet Explorer appears to refuse to accept domains that contain characters not allowed in the specification for domains. If (in a development environment, presumably), you have a domain that is invalid, IE does not like it.

The following domains are REJECTED:

a_a.aa
a%a.aa
a*a.aa
a=a.aa

with the error message: The site name you entered is not a valid IDN URL.

The testing seems to be limited to character validity and not arrangment validity, because the following domains are ACCEPTED:

aa-.aa
aa.aaa.
---.aa
-.---
---.-

Hope this helps people looking for details for why cookies aren't being set properly in IE7 / IE8 in one environment vs. another.

Upvotes: 6

conny
conny

Reputation: 10155

The cookie in your example is for the "us.is" domain. IE ignores cookies set for two-letter domains. To be more exact, it seems to ignore cookies from domains with less than 5 characters (like yours: 2+2).

I remember this bug/feature from IE6 I believe, possibly earlier versions. Reading this, it looks like the behavior is still around in IE7.

An MSKB article suggesting an unpractical workaround can be found here: http://support.microsoft.com/kb/310676.

More practical is perhaps to get a longer domain name ;-) or to make sure users are always redirected to one canonical name, i.e. "www.us.is" and plant your cookies there.

Upvotes: 9

Related Questions