Reputation: 25329
I have a web site that is hosted as an Azure App Service. I want to have one directory of that service serve files that are managed by the site. I don't really want to store the files on the App Service as I'm worried they might get deleted during a redeployment. I was thinking I would just store the files in an Azure Storage Account. I can't however see a way of forwarding on the requests to the Storage Account.
So for example:
If I have a site at example.com/
I want the file example.com/form.aspx
to be served from my App Service, but I want to have everything in example.com/File/
(e.g example.com/File/File1.jpeg
) served from my Storage Account. I don't want to do a redirect because that would change the URL the user sees in their browser.
How would you set that up?
Upvotes: 1
Views: 386
Reputation: 2307
You can move all images to a static folder and do a rewrite to the images from Static Blob content as mentioned in this answer Windows Azure Website and static html in Blob storage
Upvotes: 1
Reputation: 1970
@Martin Brown, if you want the images to be served from your storage account there's nothing 'out of the box' that will do this for you I'm afraid; you'll have to write a controller endpoint which handles requests to /File/{fileName}
, downloads the corresponding file into a stream in memory and then returns a FileResult
.
Upvotes: 1