Skip to main content

Fixing the meta type of the Nikola RSS feed in OpenBSD's httpd

In blog related news, keen observers might have noticed, that this weblog operates as a static site. That in turn is generated by a so-called "static-site generator". In this case this is Nikola. Nikola is written in Python (which makes it approachable to me, as I've a bit of Python experience). The user experience of operating the weblog with Nikola is also quite nice, especially if you like to work on the command line (and who doesn't?)

The first little snag I actually ran into, was when I was so nerdish as to validate the RSS feed. So it seems that the rss feed was served witih meta-type "application/octet-stream". There are two problems with that:

  1. The rss validation tool complains. It says that most rss readers will cope, but still it is right to complain. Machine readable formats should be handled properly.

  2. Clicking on the rss link in the browser offered to download the xml file. I'm not really reading rss feeds in the browser, but this behaviour is not correct anyway.

So, time to fix things. Looking around at what Nikola generates, there is a plain file on a file system. The meta-type header is not generated there.

Which means the OpenBSD httpd (web server) is not mapping the file extension '.xml' to the meta-type we want it to. Reading up on the httpd.conf(5) man page, I noticed that I can override meta-type definitions. At first I got it wrong, because I thought I can "override" that one meta-type I need different (setting it to application/xml xml)... but then everything else was served as the default "application/octet-stream". So I had to set up all those that are mentioned at being set by default in the man page. No biggie. And no more complaints about the meta-type in the RSS validator.