Search code examples
azureazure-functionsazure-blob-storagemime-typeshttp-proxy

Get *.html files appear to be .aspx in the url ( alias ) - using Azure blob storage


I have some files running as static content in Azure blob storage.

These files was running on another server (web-app), using .aspx instead of .html ( no back-end code here ) But now that they live in a Blob in azure, they won't display as html, if they are called *.aspx - They just start downloading for the end-user. But *.html files renders just fine.

I thought this might be a MIME issue, but they should both be "text/html" by default. although default for blob uploads is "application/octet-stream" (?)

The problem is that I need them to be named *.aspx, as there is another server pointing to those *.aspx files, that i do not control, and cannot change. - ( I am not in the position to change their names to .html and be done with it. )

Is there a way to make *.aspx files be recognized as *.html in Azure blobs storage?

If not, is there a way I can fake their names with a proxy function or with routes in Azure Functions? - to make it so that the server that points to these *.aspx files actually are routing to the *.html files in the blob?


Solution

  • Is there a way to make *.aspx files be recognized as *.html in Azure blobs storage?

    I believe the reason they're being downloaded is because of the content-type property of the blob. What you would need to do is change the content-type property of the .aspx files to text/html and then they will be rendered as HTML pages by the browser. You can change the content type property of the blobs by using Microsoft's Storage Explorer or Azure Portal.