Toxic Elephant

How to Get Apache and Typo Page Caching to Play Nice

Posted by matijs Sun, 13 Dec 2009 18:58:00 GMT

The Problem

You have been running a Typo blog since 2005, but you still can’t quite get your Apache configuration right. In particular, you still get the occasional

Not found: http://www.matijs.net/blog/2005/07.html/24/from-bryar-to-typo

Note the weird 07.html part.

The Solution

This particular message turns up if you have turned the MultiViews option on: The file 07.html was cached earlier, and Apache finds it a good candidate for the 07 part of the URL. Of course it can’t find a subdirectory 24 inside that file! I personally consider this behavior extremely weird, but that doesn’t make it go away.

The solution is to turn off MultiViews and implement a poor man’s version that does no more than what’s needed.

# Turn off MultiViews
<Directory /var/www/www.matijs.net/public>
    Options FollowSymLinks -MultiViews
</Directory>

# Rewriting must be on
RewriteEngine on

# Implement simplistic MultiViews in the blog sub-uri
RewriteCond %{QUERY_STRING} "^$"
RewriteRule ^/blog/?$ /blog/index.html [QSA,L]
RewriteCond %{QUERY_STRING} "^$"
RewriteRule ^/blog([^.]+)/?$ /blog$1.html [QSA,L]

# Implement simplistic MultiViews elsewhere (static content)
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
RewriteRule ^([^.]*)$ $1/index.html [QSA,L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.html -f
RewriteRule ^([^.]*)$ $1.html [QSA,L]

That ‘s it.

Some notes:

  1. The mapping to html files is implemented differently in the $/blog$ sub-uri than elsewhere. In the static part of the site, if there’s an URI /some/where, and and URI /some/where/else, this is stored on disk as /some/where/index.html and /some/where/else.html, respectively. In the blog part, Rails’ static caching system uses /some/where.html and /some/where/else.html.

  2. Turning on MultiViews for the static part of the site is not possible, since turning it off for the blog then does not seem to work. This may have something to do with the directory layout demanded by Passenger.

  3. It’s easy to get this wrong and cause Apache to never see the cached files. It’s also easy to get this wrong in other ways.

  4. The QSA part is probably not necessary. Call its presence a case of cargo-cult configuration.

  5. If your blog is not in the sub-URL blog you’ll have to change things, of course. Good luck.

Posted in , ,  | Tags ,  | no comments | no trackbacks

Hello New Year!

Posted by matijs Wed, 23 Jan 2008 06:36:00 GMT

It’s a new year! Time for more resolutions. I can’t believe that’s actually two years ago.

Yes, my blog has been neglected, but not for want of anything to write about. Oh, there are so many things I have an opinion about. But always, it’s the question, is my opinion interesting, new, well informed, etc? And can I write something sizable about it? Not conductive to writing every monday (recently replaced by sunday, but I bet you hadn’t guessed). Maybe I should try less hard to be reasonable.

Oh yeah, e-mail is getting better, mainly thanks to the Inbox Zero articles.

What I really want to be doing: I still don’t really know, but let’s look at what I might blog about:

  • Size is the Enemy, leading to the issue of abstractions in programming languages.
  • 80/20, or the problem of getting your average Java/.NET programmer to really learn and use new things (e.g., new methods of abstraction).
  • Lots of new languages are popping up, all running on some VM or other (e.g., Scala, Nemerle, Boo). Where’s the development in regular compiled languages?

This surely points in some direction, but some weighted average will have to be taken to find out what that direction is.

I did manage to quit the job that was definitely going in the wrong direction, so there’s a plus.

Oh, you wanted new resolutions? Hm, let’s do some:

  • Uncluttered house
  • Learn Japanese
  • Finish more software so it’s releaseable

Posted in , ,  | Tags , ,  | no comments | no trackbacks

Outage

Posted by matijs Mon, 18 Jun 2007 13:13:00 GMT

Last week, I did some work on my website, upgrading to the latest Typo trunk and Rails 1.2, and changing from mod_fcgid to a Mongrel cluster.

Last Friday or so, I rebooted my server. Unfortunately, I had neglected to make the Mongrel cluster start at boot. So for the past weekend, all you have seen here is a Service Temporarily Unavailable message.

Sorry.

Posted in  | Tags , , ,  | no comments | no trackbacks

Resistance to Posting

Posted by matijs Sun, 25 Mar 2007 13:05:00 GMT

Daring Fireball talks about about an interesting post by Tantek Cilek about Human Interface Design. It’s true that there is some cognitive load in posting a blog entry as opposed to just answering What are you doing?

Partially, that resistance is good. Like forums, or blog comments, the Twitter entries are mostly like noise. A soothing background hum that lets you know other people are alive and going about their business. Unfortunately, that business is often uninteresting in the long run. So how long are we willing to store it, even for ourselves?

On the other hand, it is annoying that I have to come up with a title that covers this little post that wanders all over the place. Or that so many thoughts end up as half-finished posts in my drafts pile.

Posted in ,  | Tags , ,  | no comments | no trackbacks

Trackback Spam

Posted by matijs Sun, 22 Oct 2006 11:23:00 GMT

The less said about it the better. I just blocked three IP ranges completely. I don’t really like to take these kinds of measures, for two reasons:

  1. I don’t want to block legitimate access to my web site.
  2. I don’t want to spend my days adjusting my firewall, adding rules whenever new spam seeps through the cracks.

Since I was spending my days cleaning up trackback spam, reason #2 stopped applying. There also didn’t seem to be any legitimate access from the blocks in question.

Damn Spam has more details on these particular spammers. You can see they’ve been at it for a while now.

Before, I only blocked one IP address. It was from a company called Webrescuer with a very impolite bot. Aparrently, being impolite wasn’t a very good business model, as they seem to be gone now. I removed the block.

Posted in  | no comments

RSS Sucks, Atom Rules

Posted by matijs Sun, 26 Mar 2006 14:37:00 GMT

Why we need Atom now
by Tim Bray (via
bitworking)
once again brought the horrors of RSS to the front of my
working memory. I will not elaborate here, but the main problem seems to be
that there are nine versions of RSS, and even
more implementations. The result is that you can never get things right.
Atom to the rescue.

Not wanting to be the
Bitch and Moan But Never Does type,
I removed all links to RSS feeds from my web site. The remaining links are
all Atom feeds, but the word Atom will not be in the link text, to
facilitate the fading of technical details into the background.
It’ll just say feed.
I will probably add the new standard feed icon.

The RSS feeds are still there, of course, since
I want my URIs to be permanent.

Posted in ,  | no comments | no trackbacks

Customizing Typo

Posted by matijs Sat, 27 Aug 2005 18:13:00 GMT

For many reasons, I like to customize the typo program code a little. Much, but not all is customizable by using themes.

I keep my version in a local repository, and I’ve just updated to typo 2.5.5. Here is the way to do these updates, partly so I can remember it myself.

Read more...

Posted in  | no comments | no trackbacks

From Bryar to Typo

Posted by matijs Sun, 24 Jul 2005 18:26:00 GMT

As of yesterday, my blog runs on Typo. All in all, I have been quite satisfied with Bryar, but it was time for a change.

I like Bryar because it is simple (no frills, entries are stored as files), and yet easy to customize (to change the layout there's basically one template to update). In addition, it is written in Perl, a language that I like, and that I'm fluent in, so getting it to work the way I wanted was easy. So, I'm happy that I chose it a year ago.

A combination of events lead me to change over to Typo.

Read more...

Posted in  | no comments | no trackbacks

Blafoolia!, for want of a better title.

Posted by matijs Mon, 24 Jan 2005 19:59:00 GMT

People who visit this site more often than once may have noticed that I changed its layout. It took a lot longer than I expected: It's easy to just whip something up that looks nice, but it's much harder to take a thought sketched on a piece of paper and make that happen in CSS. It's harder still if you want to make it work in old browsers.

In addition to the change of layout, I did a redesign of the URLs my site serves.

Read more...

Posted in  | no comments | no trackbacks

CSS Shame

Posted by matijs Thu, 25 Nov 2004 23:42:00 GMT

All this time, it turns out, people using IE5.5 (36 so far this month), and perhaps IE5.0 (44 so far this month), have been unable to read my website: The left and right sides of the text were simply cut off. I knew IE6 didn't show the vertical borders, but at least it showed the whole text.

Somehow, it feels similar to suddenly finding out you've been walking around all day with mismatched socks, or a torn shirt — assuming those things weren't part of your fashion statement. It's simply a little embarrassing. Anyway, it should all look fine now. The vertical borders even show up in IE6.

Oh, and I'm working on a new layout, so here are samples before and after, just in case the site looks completely different when you read this.

Posted in ,  | 1 comment | no trackbacks

Toxic Elephant is Matijs van Zuijlen's weblog.

Powered

Categories

Archives