Serving a WASM file from Apache

I've been spending a considerable amount of time playing with WebAssembly the last few weeks. It is fascinating what is possible in the browser. One issue that I ran into with my Ubuntu Apache setup was an the following error message:

Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.

This would be displayed in the Chrome console every time I tried to load a WASM file. The issue is that Apache has no clue what a WASM file is. To fix this issue, I had to:

  1. Edit the /etc/mime.types file using sudo
  2. Add the following line to the bottom of the file:
    application/wasm wasm
  3. Save the changes and restart Apache

Once Apache had restarted, the error went away.