Optimal settings for serving images with ImageProcessor AzureBlobCache

495 views Asked by At

I've been trying to understand the issues https://github.com/JimBobSquarePants/ImageProcessor/issues/161 and https://github.com/JimBobSquarePants/ImageProcessor/issues/178 discusses here.

I have an environment where i have my regular site on http://example.com and i have a separate site for imageprocessor served from http://d.example.com.

Then i have the Azure blob cache setup like this.

    <setting key="CachedStorageAccount" value="DefaultEndpointsProtocol=https;AccountName=***********;AccountKey=************" />
    <setting key="CachedBlobContainer" value="imgcache" />
    <setting key="UseCachedContainerInUrl" value="false" />
    <setting key="CachedCDNRoot" value="https://imgcdn.azureedge.net/" />
    <setting key="SourceStorageAccount" value="DefaultEndpointsProtocol=https;AccountName=**********;AccountKey=***************" />
    <setting key="SourceBlobContainer" value="dist" />
    <setting key="StreamCachedImage" value="false" />

It seems to work fine but i'm not sure about what is my optimal setting for the "StreamCachedImage" option.

I did some tests locally and with StreamCachedImage set to false it do a redirect to the CDN and i get a 302 and then a 200 from the CDN, and chrome says it cached so just a few bytes is transferred.

First: enter image description here

Second: enter image description here

When i switch to StreamCachedImage true i do not get a redirect and only get a 200 but it seems like it always returns the full image to the client.

enter image description here

I should also add that on top of this we also run Cloudflare against both example.com and d.example.com

But well, i basically would like to get some advice on how to set this up and to understand it fully.

0

There are 0 answers