Monday, March 21, 2022

BusyBox HTTP Daemon not recognizing mime types

Busybox is a collection of very small linux tools that can be helpful when you want to build a very small system. Among them there is a httpd server that can serve static pages. You can use this server to serve files from a folder.

My problem was trying to serve some wasm+javascript files built from rust code: the MIME type for the .wasm file was not sent.

I fixed this by creating a httpd.conf file and added these lines to it:

.wasm:application/wasm 
.js:text/javascript
.json:application/json
.html:text/html

.html was probably not necessary :-) .

Starting the server:
$ busybox httpd -p 127.0.0.1:8080 -h ./ -c httpd.conf