How to download a blob from azure storage, to a mobile device, that first goes through an Azure function for request and response?
HTTPClient using 1 request & response
mobile device (request) --> function --> blob download
mobile device (response) <-- function <-- blob download
I want to download a blob from a storage container. I want to do this through an Azure function that will process code/logic as the download request and response passes through it. My main question is how can I make the function request the blob from the blob storage container and pass it to the client without having the function download the blob first. Basically I want the blob download to pass-through the function to the client as if the client had requested the blob download directly. I use HTTPClient.
I think from your Azure function you should return a HTTP redirect
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, string path, TraceWriter log) {
// ... determine the blob you want to download ...
var response = HttpResponseMessage(HttpStatusCode.Redirect);
response.Headers.Location = new Uri(/* Azure blob URI goes here */);
return response;
}
Inspired by this blog post .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.