Mobile Apps and Web Solutions

Problem with underscores in domain names in IE

We found an “interesting” issue at work yesterday regarding IE, cookies and domain names that I thought might be useful to share.

At FindMyPast - where I’m currently contracting - we heavily use GitHub Flow which involves multiple development branches being worked on at once.

By convention we use underscores in our branch names e.g. “dev_feature_branch”, and have recently automated hosting of feature branches for test purposes. For example for the above branch we’ll setup a host for dev_feature_branch.findmypast.com

For a feature I was working on, everything worked great on Chrome and Firefox, but for some reason we couldn’t login properly using IE.

After much head-scratching, we fired up Fiddler which gave us the answer.

!! WARNING !!: Server hostname contains an underscore and this response sets a cookie. Internet Explorer does not permit cookies to be set on hostnames containing underscores. See http://support.microsoft.com/kb/316112

The obvious solution is not to use underscores in the domain name used for the virtual host, either by convention of stripping them out when setting everything up.

Hopefully if you see a similar issue, this may help you debug it quicker than we did!

N.B. This blog post has now moved to https://writingontablets.com