I would like to host the MSIX installer for my .NET MAUI application on Firebase Hosting. The problem is that when I enter the path to the MSIX in a browser, the file is opened instead of downloaded.
If I rename the file to .exe it downloads correctly, so it seams to be related to the .MSIX extension. Can this behaviour be changed in the configuration?
UPDATE: The accepted answer fixed the downloading of the MSIX file, but the Microsoft App Installer is still not able to download the MSIX file. This is probably because Firebase Hosting automatically compresses the file using Brotli compression. As I didn't find any way to disable the compression on Firebase Hosting, I instead set up hosting on AWS using an S3 bucket and CloudFront without compression. This combination worked with Microsoft App Installer.
You will have to adjust the firebase config to handle the MSIX MIME type. You will need to add a headers
configuration (if you haven't already) and set the correct MIME type for .misx files. Here is an example:
{
"hosting": {
"public": "public",
"headers": [
{
"source": "**/*.msix",
"headers": [
{
"key": "Content-Type",
"value": "application/octet-stream"
}
]
}
]
}
}
This will go in your firebase.json
file.
Using application/octet-stream
you're essentially telling the browser to treat the file as a binary stream, which will generally prompt a download dialog instead of attempting to open the file directly.
After doing this, make sure to deploy your changes before testing.