Copied to clipboard

Flag this post as spam?

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


  • Angus Atkins-Trimnell 11 posts 81 karma points
    Sep 22, 2022 @ 19:31
    Angus Atkins-Trimnell
    0

    Azure Blob Storage for Two Umbraco Sites Using Different Containers

    Hello all,

    I have two Umbraco 8.17.x instances, both of which are set up as Azure App Services. They are both configured to use the same Azure Blob Storage, but are pointed to different containers. The first one we set up is using the names "media" and "cache" for its storage containers. The second site uses "media2" and "cache2".

    The second site and first site are behaving differently.

    First Site: When I open a page on this site and view the Developer's Tools (Network tab), every request for a resource file from the Umbraco media folder gets a 302 redirect response to the blob storage container, followed by a 200 response when the resource is fetched from the blob storage container.

    Second Site: When I open a page on this site and view the Developer's Tools (Network tab), there is a mix of Umbraco media site requests that get 302 or 200 responses and requests to the blob storage container that get a 200 response. This behavior doesn't seem correct. I believe every request to to the Umbraco media folder should be met with a 302 response and the resource should be subsequently fetched from the blob storage container.

    I've confirmed that when I upload an image in the Umbraco back-end of either site, it gets uploaded to the appropriate storage container in the blob storage.

    My configuration for the second site is below.

    Web.config:

      <add key="AzureBlobFileSystem.ContainerName:media" value="media2" />
      <add key="AzureBlobFileSystem.RootUrl:media" value="https://[storage account name].z19.web.core.windows.net" />
      <add key="AzureBlobFileSystem.ConnectionString:media" value="DefaultEndpointsProtocol=https;AccountName=[storage account name];AccountKey=[account key];EndpointSuffix=core.windows.net" />
      <add key="AzureBlobFileSystem.MaxDays:media" value="365" />
      <add key="AzureBlobFileSystem.UseDefaultRoute:media" value="true" />
      <add key="AzureBlobFileSystem.UsePrivateContainer:media" value="false" />
    

    cache.config:

    <caching currentCache="AzureBlobCache">
       <caches>
           <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=[storage account name];AccountKey=[account key];EndpointSuffix=core.windows.net" />
                <setting key="CachedBlobContainer" value="cache2" />
                <setting key="UseCachedContainerInUrl" value="true" />
             </settings>
          </cache>
       </caches>
    </caching>
    

    security.config:

     <security>
       <services>
          <service prefix="remote.axd" name="RemoteImageService" type="ImageProcessor.Web.Services.RemoteImageService, ImageProcessor.Web">
             <settings>
                <setting key="MaxBytes" value="16194304" />
                <setting key="Timeout" value="3000" />
                <setting key="Protocol" value="http" />
             </settings>
             <whitelist>
                <add url="https://[storage account name].azureedge.net"/>
                <add url="https://[storage account name].z19.web.core.windows.net"/>
                <add url="https://[storage account name].blob.core.windows.net"/>
                [site host names here]
             </whitelist>
          </service>
          <service prefix="media/" name="CloudImageService" type="ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web">
             <settings>
                <setting key="Container" value="media2" />
                <setting key="MaxBytes" value="16194304" />
                <setting key="Timeout" value="30000" />
                <setting key="Host" value="https://[storage account name].blob.core.windows.net" />
             </settings>
          </service>
          <service name="AzureImageService" type="ImageProcessor.Web.Plugins.AzureBlobCache.AzureImageService, ImageProcessor.Web.Plugins.AzureBlobCache">
             <settings>
                <setting key="StorageAccount" value="DefaultEndpointsProtocol=https;AccountName=[storage account name];AccountKey=[account key];EndpointSuffix=core.windows.net" />
                <setting key="Container" value="media2" />
                <setting key="AccessType" value="Blob" />
             </settings>
          </service>
       </services>
    </security>
    

    The configuration for the first site is the same but with "media" instead of "media2" and "cache" instead of "cache2". Also, the "UseDefaultRoute:media" setting in Web.config is "false".

    Do I have my settings correct for using a non-standard name for the storage container?

    Has anyone else seen behavior in which some files are served from the Umbraco media folder and others from the blob storage container?

    Thanks for any help.

    Angus

  • Angus Atkins-Trimnell 11 posts 81 karma points
    Oct 03, 2022 @ 16:17
    Angus Atkins-Trimnell
    0

    Found the answer here.

    TLDR: processing.config had interceptAllRequests set to "false". The only media that were being served from blob storage were those with query parameters.

Please Sign in or register to post replies

Write your reply to:

Draft