Thursday, September 23, 2010

CodeIgniter Sessions + IE sucks

Man - what a pain in the ass.

Apparently the in built CodeIgniter session class and IE7/8/9 don't like each other.
On top of that, if you're using an internal computer name to access the site, well, that's not a valid W3C URL standard. You have to have at least two "." 's in the URL. So, trying to access the site via http://mycomputer is not strictly valid and IE will reject the cookie. Sigh.

So, I found the "session hybrid" class for CodeIgniter. Combining this with accessing the site via http://www.mypcname.com seems to work in IE. You also have to put the www.mypcname.com in your /etc/hosts file to make it work (otherwise it obviously will not resolve through normal DNS).

So, the long and the short is - I have sessions in OAv2 with IE7/8/9 working, but it requires a change to your /etc/hosts file (or your internal DNS). Or you could use the full domain name / path to your machine. In my case, that's rather long...

This does not affect submitting audit results, as that page does not use cookies.

If anyone has a better option - please advise.

BTW - IE6 & Firefox(3.6.9) work fine. Not sure about Chrome, Opera, et al... Strictly speaking Firefox should break just like IE if it followed standards. Maybe the Mozilla Devs are slack, maybe they thought they would deliberately _not_ meet the standard to make it easier for "internal to company" type sites - who knows ?

As per http://curl.haxx.se/rfc/cookie_spec.html,

Only hosts within the specified domain can set a cookie for a domain and domains must have at least two (2) or three (3) periods in them to prevent domains of the form: ".com", ".edu", and "va.us". Any domain that fails within one of the seven special top level domains listed below only require two periods. Any other domain requires at least three. The seven special top level domains are: "COM", "EDU", "NET", "ORG", "GOV", "MIL", and "INT".

1 comment:

  1. How about using IP address instead of FQDN? or 127.0.0.1? That's enough periods for ya... at least for testing

    ReplyDelete