diff options
author | Dante Catalfamo | 2020-08-15 02:09:38 -0400 |
---|---|---|
committer | Dante Catalfamo | 2020-08-15 02:09:38 -0400 |
commit | c667240045726aa081acda73f2f67256d8c26f77 (patch) | |
tree | fc05dbba97357e2fc92c05b0b53c858a00a6f435 | |
parent | 37b35d7c7b4797591be767861e3dbbecb717da2d (diff) | |
download | blog-c667240045726aa081acda73f2f67256d8c26f77.tar.gz blog-c667240045726aa081acda73f2f67256d8c26f77.tar.bz2 blog-c667240045726aa081acda73f2f67256d8c26f77.zip |
openbsd-mime: correct accidental downcasing
-rw-r--r-- | content/posts/openbsd-httpd-mime-types/index.org | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/content/posts/openbsd-httpd-mime-types/index.org b/content/posts/openbsd-httpd-mime-types/index.org index 7015c2d..ce3038d 100644 --- a/content/posts/openbsd-httpd-mime-types/index.org +++ b/content/posts/openbsd-httpd-mime-types/index.org @@ -1,6 +1,6 @@ #+TITLE: OpenBSD httpd MIME Types #+DATE: 2020-08-15T01:49:22-04:00 -#+DRAFT: true +#+DRAFT: false #+DESCRIPTION: How to get OpenBSD httpd to return the proper MIME types for files #+TAGS[]: openbsd httpd #+KEYWORDS[]: openbsd httpd @@ -11,31 +11,31 @@ #+ATTR_HTML: :alt OpenBSD httpd MIME type recognition [[file:cover.png]] -On openbsd's httpd, there are only a select few mime types that are -recognized by default. according to [[https://man.openbsd.org/httpd.conf.5][=httpd.conf(5)=]], those types are: +On OpenBSD's httpd, there are only a select few MIME types that are +recognized by default. According to [[https://man.openbsd.org/httpd.conf.5][=httpd.conf(5)=]], those types are: =ext/css=, =text/html=, =text/plain=, =image/gif=, =image/png=, =image/jpeg=, =image/svg+xml=, and -=application/javascript=. everything else is said to be of type +=application/javascript=. Everything else is said to be of type =application/octet-stream= by default. -this is ok for most static hosting situations, but can be challenging -for some common attachment types. for example, i recently made a blog -post that had an attached pdf. normally web browsers open pdf files in -the browser's pdf viewer, but since it was being returned with the -mime-type =application/octet-stream=, the browser decided to download -it instead of openning it directly. this isn't a tragedy, but it can +This is OK for most static hosting situations, but can be challenging +for some common attachment types. For example, I recently made a blog +post that had an attached PDF. Normally web browsers open PDF files in +the browser's PDF viewer, but since it was being returned with the +MIME type =application/octet-stream=, the browser decided to download +it instead of opening it directly. This isn't a tragedy, but it can be annoying and interrupt the flow of the user's experience. -the solution to this is to include the =application/pdf= mime type in -the [[https://man.openbsd.org/httpd.conf.5#types][=types=]] block in your =httpd.conf=. there are two ways to go about -this. either by manually defining the type you require, or including -the system's built-in mime type database. +The solution to this is to include the =application/pdf= MIME type in +a [[https://man.openbsd.org/httpd.conf.5#types][=TYPES=]] block in your =httpd.conf=. There are two ways to go about +this. Either by manually defining the type you require, or including +the system's built-in MIME type database. -using the first method you would include a types block that defines -all of the mime types you require. this types block can go anywhere +Using the first method you would include a types block that defines +all of the MIME types you require. This types block can go anywhere outside of a server declaration. -the types are defined in the format of =type/subtype name [name ...]= +The types are defined in the format of =type/subtype name [name ...]= #+begin_src types { @@ -50,12 +50,12 @@ types { } #+end_src -the second method, including the system's built-in mime types -database, is simpler if you need to support proper mime types for a +The second method, including the system's built-in MIME types +database, is simpler if you need to support proper MIME types for a larger number of files, and don't want to go through the process of -writing them all in by hand. this is done by defining a similar types +writing them all in by hand. This is done by defining a similar types block, but instead of writing in type data, you us the [[https://man.openbsd.org/httpd.conf.5#include][=include=]] -directive. openbsd's mime type definitions are stored in +directive. OpenBSD's MIME type definitions are stored in =/usr/share/misc/mime.types=. #+BEGIN_SRC @@ -65,7 +65,7 @@ types { #+END_SRC After editing the configuration file, all you have to do is reload -httpd, and it should begin recognizing file types properly. +=httpd=, and it should begin recognizing file types properly. #+BEGIN_SRC shell doas rcctl reload httpd |