cooper_milton
cooper_milton

Reputation: 87

How to redirect HTTP requests to Azure Blob Storage base urls?

We have a Blob Storage baseurl like this: https://mycompany.blob.core.windows.net/myprod .. which has several files and folders inside it.

Now, when at some point an app (not in our control) makes a HTTP request to the above URL, which now returns a 404 not found (this is Blob Storage behavior; accessing the files inside the base url is fine).

And this causes things to blow up in our setup!

So, to workaround this, we want to listen through webhooks the HTTP request made to the baseurl above (only the baseurl, not when HTTP requests are made to files inside it) and return a 200 from an Azure Function.

Is this possible and how?

Upvotes: 1

Views: 2012

Answers (1)

David Makogon
David Makogon

Reputation: 71119

You cannot intercept calls pointing directly to blob storage. That DNS name (yourname.blob.core.windows.net) routes directly to Azure Blob Storage.

If you specifically need to intercept calls, then you need to route them to a dns name of your app (e.g. yourname.azurewebsites.net or yourname.com mapping to yourname.azurewebsites.net, if it's a web app). At this point, you could redirect to whatever you want (including blob storage URI's).

Note: Any blob URI you redirect to either needs to be public-accessible or have a Shared Access Signature (or policy) for your client app to get to it, otherwise a 404 will result.

Upvotes: 1

Related Questions