splitbrain.org

electronic brain surgery since 2001

MSIE sucks (again)

pic by icanhazcheesburger

Over the recent months, the load on my server increased. One reason was that visitor numbers are increasing as well (yeah!). However in the last days the load climbed much higher than it was explainable by increased interest.

A top did show a high CPU usage by the MySQL database. But on my server the site with the most visitors by far is the wiki. And as we all know, there is no database used by DokuWiki. So my first guess was the forum.

My guess was right, as soon as I slayed the forum fastcgi backend the load went down 1).

The access log was showing requests for very strange URLs. I grepped for the IP of one user requesting such an URL, and this is what I saw:

[13/Jun/2008:20:26:49 +0200] "GET /thread/948 HTTP/1.1" 200 28425 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;1813)"
[13/Jun/2008:20:26:52 +0200] "GET /thread/948/unb_lib/common.js HTTP/1.1" 200 28425 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;1813)"
[13/Jun/2008:20:26:54 +0200] "GET /thread/948/unb_lib/unb_lib/common.js HTTP/1.1" 200 28425 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;1813)"
[13/Jun/2008:20:26:59 +0200] "GET /thread/948/unb_lib/unb_lib/unb_lib/common.js HTTP/1.1" 200 28425 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;1813)"
[13/Jun/2008:20:27:01 +0200] "GET /thread/948/unb_lib/unb_lib/unb_lib/unb_lib/common.js HTTP/1.1" 200 28425 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;1813)"
[13/Jun/2008:20:27:04 +0200] "GET /thread/948/unb_lib/unb_lib/unb_lib/unb_lib/unb_lib/common.js HTTP/1.1" 200 28425 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;1813)"
[13/Jun/2008:20:27:08 +0200] "GET /thread/948/unb_lib/unb_lib/unb_lib/unb_lib/unb_lib/unb_lib/common.js HTTP/1.1" 200 28425 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;1813)"

Looked like some infinite redirect going on, but why?

Digging through the page source the following code jumped at me:

<base href="http://forum.dokuwiki.org/" />
...
<script type="text/javascript" src="unb_lib/common.js"></script>

Could it be that Microsoft's Internet Explorer had trouble using the base href? A bit of googling confirmed it. MSIE ignores the tag for javascripts and requests the document from the wrong URL. Usually this would result in a 404 but URL rewritig at the server will just return the very same page again, which causes IE to load the script again, which will… well, you get the idea.

I fixed the problem by hacking the UNB sources to return an absolute path for the scripts. In line 251 of unb_lib/common.lib.php I simply prepended a slash:

//$UNB['LibraryURL'] = TrailingSlash(rc('lib_url'));
$UNB['LibraryURL'] = '/'.TrailingSlash(rc('lib_url')); //hard code basedir

There are three things we can learn from that:

  1. Developers should never rely on base href.
  2. Admins should always check the user agent first, when something is wrong.
  3. Users should already stop using Internet Explorer. Please?!
Tags:
msie, dos, basehref, unb, load
Similar posts:
1)
sorry if you got a 500 during that time