This morning, I awoke to an email from El Oso telling me that the link to my archive list was broken; sure enough, it was, and that was totally confusing to me, seeing as I had made no recent changes to the structure of my site. It bugged me the whole way to work, and despite being in clinic all day, between patients I kept sneaking a peek at the relevant bits of code to see if I could figure out the problem. I wasn’t able to find anything overwhelmingly wrong, though, other than the fact that the the archive index page was just plain horked.

After clinic, I dug in a bit deeper, and finally found a post over at WebmasterWorld that seemed to describe the problem I was seeing — and happily, it made it seem like the problem was a bug in Apache (and specifically, the version of Apache to which I upgraded two weeks ago), rather than some dumbassed configuration error on my part. I came home and put together a test case that reproduced the behavior I was seeing, and then submitted it to the maintainers of Apache as a bug. We’ll see what comes of it; in the mean time, I threw together a workaround so that my archives can shine once again!

(And of course, if there are any Apache wizards reading this, feel free to take a look at the test case and point out where my understanding of mod_rewrite and mod_dir completely sucks; while I feel that there’s likely to be a bug here, I also recognize that there’s just as likely to be an idiot with a poor understanding of Apache on this side of the keyboard.)

Comments

You should include your httpd.conf file on the page as well. Your settings for DirectoryIndex and DirectorySlash make a big difference in this case; other configuration directives in the file may also be quite important.

• Posted by: Sam Greenfield on Sep 14, 2004, 7:48 AM

I’m a little averse to posting my entire httpd.conf file, mostly for security reasons; that’s not a file that’s meant to be public. The relevant bits of it are available in the Apache Bugzilla posting, though, and I’m happy to answer questions about it if someone thinks that there’s an answer in there.

Oh, and the DirectorySlash directive isn’t even in a public build of Apache yet, but reading about it makes me wonder if (when available) it will at least provide for a workaround to the problem.

• Posted by: Jason on Sep 14, 2004, 9:19 AM

Jason and I exchanged a bit of email to track down this bug. I was incorrect about including the httpd.conf page; in fact, I was able to replicate the behavior on my W2K box. Jason is totally correct about DirectorySlash; this is what I get from reading the source code without looking at the tags.

A full description of the problem can be read at the Apache bugzilla site Jason provides above. It looks like the problem can be avoided by using the passthrough (PT) flag on the mod_rewrite rule. However, PT only works on server-wide directives, not per-directory directives.

The behavior of PT is well documented in the source code, but not so much in the documentation. The behavior of PT should probably be changed; at the very least, the documentation should be updated.

The Apache code is fairly well written and documented; I don’t know if I have every had an easier time cold-reading third-party source code on such a complex project. They have really good naming conventions.

• Posted by: Sam Greenfield on Sep 14, 2004, 3:02 PM
Please note that comments automatically close after 60 days; the comment spammers love to use the older, rarely-viewed pages to work their magic. If comments are closed and you want to let me know something, feel free to use the contact page!