Cache Control Using PHP Azure SDK

Nov 18, 2010 at 4:16 PM
Edited Nov 18, 2010 at 4:20 PM

I have been trying to set the cache control header for an Azure blob using the PHP Azure library API.  The putBlob() method and script work fine otherwise, it uploads a file as a blob to a container, it even sets the metadata as specified in the 4th parameter.  However, the 5th parameter, designated for "additional headers" does not seem to have any effect.  I attempted various tweaks and tests, but none seem to take as I do not see any of the additional headers when I use Curl on the object URL.  

Here is a snippet of the PHP code I use:

$metaData = array(
 "foo" => "bar"

$addHeaders = array(
 "x-ms-version" => "2009-09-19",
 "x-ms-blob-cache-control" => "public, max-age=7200"

$putResults = $azure->putBlob("$container", "$destPath", "$localPath", $metaData, $addHeaders);


I thought I could set this Cache Control as a "Blob Property", but I could not find a method to set Properties in the PHP SDK.

Any suggestions?  Thanks

Nov 18, 2010 at 7:07 PM

I think you've hit a bug there. How large is the blob? (BTW cross posting this at as well)

Nov 18, 2010 at 7:08 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Nov 18, 2010 at 8:12 PM

Hello and thanks for replying.  I commented on the work item here, with the comment copied below:


I tried putBlob() with several files, but definitely with tiny files. I also tried setBlobMetadata() which should not depend on Blob size. So the additional headers issue affects all instances of additional headers.

A different bug is that if you use putBlob() with a large file, the PHP logic will check the file size and call putLargeBlog() instead. But putLargeBlog() does not have a parameter for "additional headers". So if you attempted to use additional headers with putBlob and a large file, the headers will be lost.