Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure File Storage Error: Condition Headers Are Not Supported

When attempting to download a PDF file to a browser directly from Azure File Storage I get this error:

<Error>
    <Code>ConditionHeadersNotSupported</Code>
        <Message>
            Condition headers are not supported. RequestId:a84ee68e-   001a-001b-4223-bff5e7000000 Time:2017-04-27T06:57:22.2002199Z
        </Message>
</Error>

Edge: Blank page or blank page with frozen loading indicator.

FireFox: Second time, shows dialog to download file.

Chrome: Blank page or When PDF Documents “Open PDF files in default PDF viewer application” setting is checked, shows dialog to download file.

IE: Shows dialog to download file.

Safari: Displays PDF.

The behavior can be seen here:
https://peachstatepca.file.core.windows.net/content/newsletters/PresseApril2017.pdf?sv=2016-05-31&sr=f&sig=rkQEmY6IWXZqcgvhmm00gLQ%2FCZEq6nsH95S3aP9T72A%3D&se=2017-05-01T11:46:18Z&sp=r

like image 679
TLP Avatar asked Apr 30 '17 12:04

TLP


2 Answers

We were also facing this issue and the easiest way, till Azure File Team implements the suggestion given in the Azure Feedback forum, a workaround is to append extra parameter at the end of URL. So, for the above URL -- https://peachstatepca.file.core.windows.net/content/newsletters/PresseApril2017.pdf?sv=2016-05-31&sr=f&sig=rkQEmY6IWXZqcgvhmm00gLQ%2FCZEq6nsH95S3aP9T72A%3D&se=2017-05-01T11:46:18Z&sp=r&xyz=timestamp of client

This will ensure browser is not caching and hence conditional headers will not be added

like image 172
Samir Baid Avatar answered Oct 13 '22 12:10

Samir Baid


Azure File storage doesn't support Conditional Headers at this time.

A workaround is to use the CacheControl property and set it to no-cache, no-store, must-revalidate.

  • You can do this for new files during upload by setting the Properties of the File.
  • For existing files, they can be updated via a Powershell script, or one by one using Storage Explorer. You'll need to clear your browser cache to remove existing cached header information.

Using Storage Explorer to set CacheControl property

like image 43
Jake Edwards Avatar answered Oct 13 '22 12:10

Jake Edwards