Cookie debugging fun
Tech Web Economist
Published: 2010-10-20

We enountered a strange issue yesterday with a mysterious disappearing cookie. It turned out that an invalid favicon.ico link was causing the issue. The Drupal CDN module rewrites the favicon link to be served from media.economist.com:

<?php
  <link rel="shortcut icon" href=
"http://media.economist.com/sites/all/themes/econ/favicon.ico"
type="image/x-icon" />
?>

The CDN, however, wasn't configured to serve .ico files, so it was issuing a redirect to http://www.economist.com (the home page). That caused weirdness with the favicon in general, although sometimes it would appear depending on the user's browser.

When going to an Economist Channel page, the cookie would initially be set by the first set of response headers, then the favicon would load a redirect to the homepage, which immediately clears the cookie (correct behaviour). However, there were no visible side effects that anything is going wrong except an occasionally wonky favicon.