little green footballs

Tech Note: Mysterious Bug Fixed?

Mon, Sep 29, 2008 at 10:27:56 am

If you’ve been having any of the following problems at LGF:

* Login from the main page doesn’t work, but clicking through to an article page and logging in does.

* The “top rated links” area just spins and spins and doesn’t open, until you click through to another LGF page.

* The RSS feeds won’t display.

* Other seemingly Javascript/Ajax-related issues.

... we’ve finally managed to duplicate the symptoms, diagnose the problem, and eradicate the bug.

The cause: accessing our front page with a URL including the “www.” prefix. Yes, really, that’s all it was. Most browsers will see “www.littlegreenfootballs.com” as a different domain than “littlegreenfootballs.com,” and Javascript’s same-domain security features kick in, refusing to allow access to scripts with URLs that don’t include the “www.”

The solution was found on this page; a method of forcing all page requests to remove the “www.” prefix, by using mod_rewrite.

This should eliminate a constant source of annoyance for visitors, and a constant source of problem complaints for Stinky Beaumont.