Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Carl Jackson 139 posts 478 karma points
    Feb 15, 2018 @ 15:45
    Carl Jackson
    0

    AzureBlobCache and media container not called "media"

    Has anyone come accross issues when using the azure blob cache and image processor

    The following config fails to load any image crops, however if I rename the container from "websitename-media" to "media" and update the config to match the crops load fine.

    Because I have several sites in the same account it is not possible to call all of the containers "media"

    <?xml version="1.0" encoding="utf-8"?> <caching currentCache="AzureBlobCache"> <caches> <cache name="AzureBlobCache" type="ImageProcessor.Web.Plugins.AzureBlobCache.AzureBlobCache, ImageProcessor.Web.Plugins.AzureBlobCache" maxDays="365"> <settings> <setting key="CachedStorageAccount" value="DefaultEndpointsProtocol=XXX" /> <setting key="CachedBlobContainer" value="websitename-cache" /> <setting key="UseCachedContainerInUrl" value="true" /> <setting key="CachedCDNRoot" value="https://xxx.blob.core.windows.net" /> <setting key="CachedCDNTimeout" value="1000" /> <setting key="SourceStorageAccount" value="DefaultEndpointsProtocol=XXX" /> <setting key="SourceBlobContainer" value="websitename-media" /> <setting key="StreamCachedImage" value="false" /> </settings> </cache></caches> </caching>

  • Carl Jackson 139 posts 478 karma points
    Feb 15, 2018 @ 16:25
    Carl Jackson
    0

    I've narrowed it down a little

    In the security config if I change just the host to :

    <setting key="Host" value="https:/website/media/"/>

    rather than :

    <setting key="Host" value="https:/website/website-media/"/>

    everything works as it should as long as there is a duplicate container called "media"

    Not sure what this means unfortunately

  • Kevin Meilander 18 posts 129 karma points c-trib
    Feb 15, 2018 @ 20:32
    Kevin Meilander
    0

    Is the container name for your AzureBlobFileSystem provider in filesystemproviders.config set to "websitename-media"?

  • Carl Jackson 139 posts 478 karma points
    Feb 15, 2018 @ 23:21
    Carl Jackson
    0

    It is yes.

    I think I've found the issue but don't think its easily resolvable.

    it seems to be a conflict with

    <add key="useDefaultRoute" value="true" />'

    in filesystemproviders.config

    if this is set to false, and you attempt to access the media via the blob containers name the cache works fine eg

    http://mywebsite/website-media/1001/image.jpg?crop-query-here

    Setting this it to true works as long as your not using imageprocessor functionality, as soon as you need to it breaks it completely for any cache type, ironically only if you are not using 'media' as the container name.

    Anyone know if this an umbraco issue or blobcache plugin one?

  • Kevin Meilander 18 posts 129 karma points c-trib
    Feb 15, 2018 @ 23:41
    Kevin Meilander
    0

    We use custom media container names in our azure file blob storage provider and useDefaultRoute set to true. But we do not use the blob cache so I would probably start by looking at the blobcache.

    Can you update your cache to use the diskCache temporally to see if that's what's causing the issue?

  • James Jackson-South 489 posts 1742 karma points c-trib
    Feb 16, 2018 @ 06:08
    James Jackson-South
    100

    Ok....

    I can't see a config for the CloudImageService in your question so it's pretty much guesswork from here.

    First things first, Let's have a look at your AzureBlobCache directory.

    <cache name="AzureBlobCache" type="ImageProcessor.Web.Plugins.AzureBlobCache.AzureBlobCache, ImageProcessor.Web.Plugins.AzureBlobCache" 
           maxDays="365" browserMaxDays="7" folderDepth="6" trimCache="true">
      <settings>
        <setting key="CachedStorageAccount" value="DefaultEndpointsProtocol=https;AccountName=[CacheAccountName];AccountKey=[CacheAccountKey]"/>
        <setting key="CachedBlobContainer" value="websitename-cache"/>
        <setting key="UseCachedContainerInUrl" value="true"/>
        <setting key="CachedCDNRoot" value="[CdnRootUrl]"/>
        <setting key="CachedCDNTimeout" value="1000"/>
        <setting key="SourceStorageAccount" value="DefaultEndpointsProtocol=https;AccountName=[SourceAccountName];AccountKey=[SourceAccountKey]"/>
        <setting key="SourceBlobContainer" value="websitename-media"/>
        <setting key="StreamCachedImage" value="false"/>
      </settings>
    </cache>
    

    Config Notes:

    SourceStorageAccount and SourceBlobContainer add overhead to the process since they check the source image to determine whether it has changed from when the image was originally uploaded. If you don't need this, don't bother with it.

    Looking at the CachedCDNRoot you're not setting the CDN url, only the blob one.

    Now. Back to the question....

    I think I see where your confusion is lying.

    Three things you need to understand:

    1. ImageProcessor.Web and FileSystemProviders.Azure have no knowledge of each other.
    2. ImageProcessor.Web has no knowledge of Umbraco, it is designed for any ASP.NET website.
    3. ImageProcessor.Web only intercepts requests with commands width=100 etc.

    So with that in mind, let's have a look at the following request.

    http://mywebsite/website-media/1001/image.jpg?crop-query-here

    This works with the useDefaultRoute setting set to false because the the source image is physically located within the website-media folder. and the path generated by Umbraco uses the relative path /website-media .

    With the useDefaultRoute setting set to true, while the source image is physically located within the website-media folder, the path generated by Umbraco uses the relative path /media .

    As such, no IImageServices know where to look for the source image!

    I'm assuming your CloudImageService is set up to look something like this:

    <?xml version="1.0"?>
    <security>
      <services>
        <service prefix="websitename-media/" name="CloudImageService" type="ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web">
          <settings>
            <setting key="MaxBytes" value="8194304"/>
            <setting key="Timeout" value="30000"/>
            <setting key="Host" value="http://[myAccountName].blob.core.windows.net/websitename-media/"/>
          </settings>
        </service>
      </services>  
    </security>
    

    The key to letting ImageProcessor.Web know how to get the image would be to set the prefix value to the following. prefix="media/"

    That way it still requests the correct blob but can recognise the url generated by Umbraco.

    Does all that make sense?

  • Carl Jackson 139 posts 478 karma points
    Feb 16, 2018 @ 09:43
    Carl Jackson
    0

    Hi James.

    Thanks for your explanation - makes it does make sense and essentially all I was missing was the prefix as you suggested!

    Thanks for your help with this!

    Carl

  • James Jackson-South 489 posts 1742 karma points c-trib
    Feb 16, 2018 @ 10:44
    James Jackson-South
    0

    Great Carl!

    Very happy I was able to help, any other issues don't hesitate to ask.

    Cheers

    James

  • Ronen Rimon 21 posts 123 karma points
    Apr 30, 2020 @ 19:05
    Ronen Rimon
    0

    Hi jamse, I have a problem with azure cdn + umbraco that you maybe can help. I have 2 projects one umbraco 7.15.3 and the second is umbraco 8.6.1 both configured to work with azure storage and cdn (every project with its own storage) both are working fine except for one problem with the umbraco 8

    the flow is like this: i upload an image from the umbraco backoffice media section. i can see the image in the right folder in azure storage and i can see the thumbnail in umbraco media section

    but when i click the image i can see the properties of it but no image :(

    i made number of test and realized that when i use the imageprocessor the image is served with no problem (that is the reason that i can see the thumbnail in umbraco backoffice, the url is http://localhost:6365/media/53lfufg3/call.png?width=500&mode=max&animationprocessmode=first it uses the imageprocessor and everything is working) but when I request the image like http://localhost:6365/media/53lfufg3/call.png i get nothing

    any idea? please help if you think of anything that can cause this behavior thank you

Please Sign in or register to post replies

Write your reply to:

Draft