site

source files for beau's website
git clone https://git.beauhilton.com/site.git
Log | Files | Refs

commit e3032e9ee0ae4e46b28938a4359fe345a0f29b13
parent 995eb259cb1bcb4fd71b6cffc5df5642f05a5f0d
Author: Beau <cbeauhilton@gmail.com>
Date:   Sun, 13 Nov 2022 16:13:24 -0600

mime types post, feed, add to index

Diffstat:
Mfeed.xml | 9++++++++-
Mposts.md | 2++
Aposts/mime.md | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 103 insertions(+), 1 deletion(-)

diff --git a/feed.xml b/feed.xml @@ -9,7 +9,14 @@ <generator>my own two hands</generator> <managingEditor>beau@beauhilton.com (Beau Hilton)</managingEditor> <webMaster>beau@beauhilton.com (Beau Hilton)</webMaster> - <lastBuildDate>2022-11-11T00:00:01Z</lastBuildDate> + <lastBuildDate>2022-11-13T00:00:01Z</lastBuildDate> + <item> + <title>fix MIME Types to unbreak RSS feeds served by OpenBSD's httpd(8)</title> + <link>https://beauhilton.com/posts/mime.html</link> + <guid>https://beauhilton.com/posts/mime.html</guid> + <pubDate>2022-11-13T15:04:26Z</pubDate> + <description>Add more MIME Types to `httpd(8)` so RSS feed readers know what they're getting into.</description> + </item> <item> <title>upgrade old OpenBSD installs</title> <link>https://beauhilton.com/posts/ugbsd.html</link> diff --git a/posts.md b/posts.md @@ -1,5 +1,7 @@ # Posts +## [fix MIME Types to unbreak RSS feeds served by OpenBSD's httpd(8)](posts/mime.html) + ## [upgrade old OpenBSD installs](posts/ugbsd.html) ## [geocheatcode](posts/geocheatcode.html) diff --git a/posts/mime.md b/posts/mime.md @@ -0,0 +1,93 @@ +# fix MIME Types to unbreak RSS feeds served by OpenBSD's httpd(8) + + +## RSS is life - but mine was broken + + +As of today (2022-11-13) my website lives on +an OpenBSD server hosted at [vultr](https://vultr.com). + +It's great, delightfully simple and low-resource, +robust, extendable, low-maintenance. + +I've been getting back into RSS lately. +Turns out, my own RSS feed was broken. +I knew it was janky, but would have had no idea how broken it was +if not for the great folks +on the [datasette](https://datasette.io) Discord, +one of whom reached out to let me know my RSS link wasn't working. + +This could not stand! + +I've been meaning to fix my RSS feed anyway, +and now I had a good reason. + + +## fixing the file itself + + +I ended up tearing out my previous RSS solution, [`rssg`](https://romanzolotarev.com/rssg.html),which is great but made some assumptions about my site's layout that aren't true. +I could have rewritten the script, +but I'm lazy and a little strapped for time, +so I ended up replacing it with a hand-written RSS file. + +(The RSS spec is easy enough to write by hand, +a little copy-paste and replace to add a new article - +at some point I'll probably migrate to `hugo` or similar +and hand off the feed creation to a more flexible script, +but for now this works). + +After I was certain the file format was fine and had the info I wanted, +I thought I was good. + + +## fixing the MIME Type + + +The kind soul who reached out to let me know the RSS feed was malformed +reached out again to let me know he was now getting a MIME Type error. + +My feedreader of choice, `newsboat`, +is very forgiving of what it accepts, +and didn't throw any errors when I tested it. +`FreshRSS`, on the other hand, is more strict, +and the feed would fail even though the file itself was fine. + +I looked into it, and found out that `httpd(8)` +only supports a handful of MIME Types by default, +so my server was sending out `application/octet-stream` +(a generic type) instead of the `rss+xml` type, +and it was confusing the feedreader. + + +## add all the types + + +Thank goodness, and as usual in OpenBSD, +there's a very easy way to add all the relevant types one might need. + +OpenBSD has an internal MIME declaration file you can link to from within `httpd.conf(5)`. + +Here's the relevant bit, just chuck this on the end of the conf file: + +``` +types { + include "/usr/share/misc/mime.types" +} +``` + +And reload `httpd(8)`. + + +## great success + + +Much thanks to my new friend on the Datasette Discord, +the fantastic OpenBSD documentation, +as always, +and [lambda.cx](https://blog.lambda.cx/posts/openbsd-httpd-mime-types/) +for writing a post almost identical to mine +(except that his had nothing to do with RSS - +he was fixing PDF serving, +which should now be fixed on my site as well). +