Azure blob file can be downloaded using any browser or internet download manager. For a public blob the url of file would suffice, but for downloading a private blob one needs to create a url containing the Secured Access Signature
While testing downloads I realized that in case I pause and resume the download in Firefox or Chrome or any download manager the download restarts !!! I was expecting that the download should start from the place it paused. Imagine the scenario where we have uploaded half of a 2GB file and resuming the download would start over again !!! Clearly the Azure Blob storage was not supporting HTTP Range header
As it turns out the Azure blob service is not a trivial file server. It is more of a Storage Application Server. It exposes an REST API
to interact with it. The ability to support Range header(hence resume) was added in a later version of Blob API.
The default API version that we interact with is 2009-09-19. This is the version used in case we do not specify any (version can be added in HTTP header x-ms-version). Since the browser does not send any custom version header while making the GET request we do not get the resume support.
The fix here was to update the blob service properties for our account using the Set Blob Service Properties
API method. This method takes a parameter DefaultServiceVersion
. This parameter defines the default version of blob API to use in case API version is not specified in the HTTP header. Setting this value to 2011-08-18
fixed the resume problem.
Now the browser was able resume broken downloads and download managers could even download in multiple chunks to improve download speed.
I did not find any option in the Azure Management portal that allows us to set the the above property so I had to do it using the REST API. I am sharing the code that I used to update the API version below