Azure App Service and MIME Types

Recently I started hosting my blog on Azure.
All was working great untill I tried to upload .mp4 video to WordPress Media Library.
Upload itself was working fine, but video could not be played. I got errors:

  • The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
  • Media error: Format(s) not supported or source(s) not found
  • 404

After searching endlessly what’s the issue with WordPress and videos – I found out that there isn’t :).
The issue turned out to be in how App Service was configured… For some reason, mimeMap for .mp4 is not set – and when we query for the file, we get 404.

Configure MIME Types in App Service

Configuring MIME types turned out to be less intuitive than I expected.
Go to your App Service in Azure Portal, and look for App Service Editor (Preview):

In App Service Editor, find web.config and add .mp4 mimeMap:

And that’s it! Videos from WordPress Media Library will work now.

Additional Note

In addition to silly MIME issue, it turned out that WordPress itself has some silly rules about video files. If file contains – or x (example: my-cool-video320x240.mp4) it will not work :O
This one has nothing to do with Azure – seems to be WordPress related.

So, to be safe, when troubleshooting Media Library video issues, name your file “video.mp4” – and only after it starts to work, go funky with naming.

Leave a Reply

Your email address will not be published. Required fields are marked *