Azure File Storage URL in browser showing InvalidHeaderValue

38,175

Solution 1

Gaurav already mentioned a similar question here where it says you should use a "Shared Access Signature". In your storage account settings in Azure you'll find a topic "Shared Acess Signature". After clicking "Generate SAS" you'll get a "SAS Token" which you need to append to your URL.

Shared Access Signature

Solution 2

If you use Azure File service to share your files, you have to add SAS token after your resources URL. e.g. https://testiiju5zra.file.core.windows.net/alexaskillaudio/lamb.mp3?sv=SDFCSGDJ01231%&SDDFXsuSDFSDSDSSFD

Alternatively, you can do the exact same things by using Azure Blobs as well. If you use Blobs, you don't have to add the extra token after resources URL. Just create a container on Blobs and make it public. And you can access your file like
https://testiiju5zra.blob.core.windows.net/blobaudiosource/lamb.mp3

Solution 3

Mike,
The error you received indicates that you are missing x-ms-version header. But once you set it, you will receive another error if you have not authenticated. You can refer to https://msdn.microsoft.com/en-us/library/azure/dn194274.aspx for list of required headers. Alternatively, you can use client library for the requests instead of REST API.

Solution 4

Try to use a blob instead. Here is an article how to set it up.

https://docs.microsoft.com/en-gb/azure/storage/blobs/storage-blob-static-website-how-to?tabs=azure-portal

Share:
38,175
Mike Flynn
Author by

Mike Flynn

I am the founder and CEO of Exposure Events. Exposure Events is a tournament and league management system delivering online scheduling and conflict checker, live results, apps, free directory and more.

Updated on September 23, 2020

Comments

  • Mike Flynn
    Mike Flynn over 3 years

    I am trying to access the URL given in Azure for a file on the Azure File Storage format, however I am getting this error below. Is it possible to get this? Why would they offer a public URL when it's useless? Also how can I access this directly from IIS?

    <Error>
    <Code>InvalidHeaderValue</Code>
    <Message>
    The value for one of the HTTP headers is not in the correct format. RequestId:5d681103-0a1a-00cc-5555-5s4849000000 Time:2016-02-04T14:06:50.1786949Z
    </Message>
    <HeaderName>x-ms-version</HeaderName>
    <HeaderValue/>
    </Error>
    
  • johnstaveley
    johnstaveley over 5 years
    What if I want to make an azure file share public without the token. A lot of my calls will be http gets from web pages where I am not able to append this token
  • TommyLeong
    TommyLeong over 2 years
    Instead of generating SAS token, it's recommended to generate a SAS derived from Stored Access Policy. May refer to the steps given here.