1

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?

Martin Brown
  • 24,692
  • 14
  • 77
  • 122
  • Not sure whether I understand the question. Perhaps you need ‘Azure Data Lake Gen 2’ which support hierarchical namespace to Blob storage. – Huodong Apr 18 '20 at 15:19
  • You should be able to use IIS ARR URL Rewrite in the front-ends. Per https://stackoverflow.com/questions/36630536/rewriting-a-url-in-an-azure-web-app and https://www.solutionwave.net/2018/02/15/using-a-reverse-proxy-to-serve-azure-blobs-from-your-primary-domain/ – David Browne - Microsoft Apr 18 '20 at 15:35

2 Answers2

1

@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.

simon-pearson
  • 1,601
  • 8
  • 10
1

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

Puneet Gupta
  • 2,237
  • 13
  • 17