2
votes

I'm having a problem setting the Cache Control header for a blob.

I'm setting the CacheControl by using the Azure Storage Explorer. I'm simply selecting the blob, clicking properties, and filling in the CacheControl field with "public, max-age=31536000" (without the quotes).

I'm downloading the blob directly from *.blob.core.windows.net/coreimages/test.png.

However, when viewing the headers in Google Chrome, it's showing: max-age=0

Am I doing something wrong? I've tried setting the mime and it's being saved correctly.

Thanks for any help.

3

3 Answers

2
votes

I have tested that and it works perfectly fine:

Azure Headers

A few things to check:

  • Are you sure Azure Storage Explorer supports Cache-Control header? I used CloudBerry and had no issue with the header.
  • Are you sure you set correct header name: Cache-Control instead of CacheControl (link)
1
votes

I have tested that too in Azure Storage explorer and it worked. Although it seems like it saves the value to the blob (image), it is not capable to show it back when you open it again. I just checked and that is a known issue of the Azure Storage explorer, please go to this link and vote to get it fixed please:

http://azurestorageexplorer.codeplex.com/workitem/7580

If you must do it for several files, there is a good script snippet here:

Add Cache-Control and Expires headers to Azure Storage Blobs

0
votes

Usually, default Blob Storage does not use cache control. For that you should create A CDN , in the cloud, ( there is an option for that, then you set your endpoint, to point to that blob storage container ( public), and its the CDN that caches content.

https://azure.microsoft.com/pt-pt/documentation/articles/cdn-manage-expiration-of-cloud-service-content/