Using custom media types with blop storage (vtt, webm, webp, ogg, etc)

I’m running an Umbraco site (v10+) using AzureBlobMediaFileSystem to store media in Azure Blob Storage.

I’ve added vtt to the AllowedUploadFileExtensions in appsettings.Development.json like so:

"Umbraco": {
  "CMS": {
    "Media": {
      "AllowedUploadFileExtensions": [
        "jpeg", "jpg", "png", "gif", "svg", "webp",
        "mp4", "webm", "vtt", "srt", "pdf", "docx",
        "xlsx", "pptx", "txt", "zip"
      ]
    }
  }
}

The upload works fine from the backoffice, and the file appears in the Azure Blob container.
However, when I try to access the .vtt file via the public media URL (e.g. /media/xxxx/filename.vtt), it returns a 404.

Here’s what I’ve checked:

  • The file is present in the blob container.
  • Public blob access is enabled.
  • I’ve verified that the blob has the wrong Content-Type (shows application/octet-stream instead of text/vtt).
  • I suspect Umbraco isn’t setting the correct MIME type when uploading.

Questions:

  1. How can I force Umbraco to set the correct Content-Type (e.g., text/vtt) on upload?
  2. Is there a built-in way to configure MIME types for Azure media file uploads in Umbraco?
  3. Do I need to hook into FileUploading and set the content-type manually via a component?

Well, @warren came to the rescue with this solution.

Add to program.cs

var customContentTypes = new FileExtensionContentTypeProvider();
customContentTypes.Mappings[".vtt"] = "text/vtt";

services.PostConfigure<StaticFileOptions>(opt =>
{
    opt.ContentTypeProvider = customContentTypes;
});
1 Like