• MrGregWaugh

    (@mrgregwaugh)


    This is actually a follow up to my earlier post “Add Cache Control headers for uploaded blobs”. It would be really great to be able to add Cache-Control HTTP headers to the blob object to enable better CDN and browser caching for this static content. This could be done easily just be adding one additional filter to allow the addition/modification of the allowed_properties.

    Basically, adding a filter such as this into Windows_Azure_Rest_Api_Client::put_blob_properties() (like 810) would enable that:

    $properties = apply_filters( 'azure_blob_put_blob_properties', $properties, $container, $remote_path );

    Would it be possible to consider this for inclusion?

    Many thanks.

    GW

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Ritesh Patel

    (@ritteshpatel)

    Hi @mrgregwaugh

    Yes, this can be done. It will be great if you can open a pull request for this on github repo: https://github.com/10up/windows-azure-storage/

    Regards,
    Ritesh

    I was just coming to request this feature. Azure Blob image assets uploaded from this plug not having a cache control headers really hurts Google PageSpeed, YSlow scores, etc.

    Thread Starter MrGregWaugh

    (@mrgregwaugh)

    Yes, this was included in the last release of the plugin. Just use this code in your functions.php or wherever and this will be added to all subsequent uploads.

    
    function azure_storage_blob_properties( $headers ) {
        $headers['x-ms-blob-cache-control'] = 'public, max-age=604800';
        return $headers;
    }
    add_filter( 'windows_azure_storage_blob_properties' , 'azure_storage_blob_properties' );
    • This reply was modified 7 years, 10 months ago by MrGregWaugh.

    Any way you can do it for previous uploads? Would regenerating thumbnails work or do you have to upload them all again?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Headers for uploaded blobs’ is closed to new replies.