Copied to clipboard

Flag this post as spam?

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


  • Samoura 5 posts 97 karma points
    May 28, 2019 @ 04:31
    Samoura
    1

    AzureCDNToolkit not using CDN URL but redirects to Azure blob storage URL

    I'm using Azure CDN Toolkit (v0.1.12-beta) with Umbraco 7.13.1. My images are getting resized and stored into cache Azure blob.

    However, the generated page never seems to redirect to the CDN URL, it always redirects to the root Azure storage URL (https://blah-blah.blob.core.windows.net/cache/e/9/1/e/1/1/some-image-name.png)

    These URLs are generated in razor templates using:

    @Url.GetCropCdnUrl(img, width:768, height:470)
    

    In imageprocessor/cache.config I have

    <setting key="CachedCDNRoot" value="https://my-cdn-url.azureedge.net/" />
    

    in web.config I have

    <add key="AzureCDNToolkit:Domain" value="https://my-domain.com" />
    <add key="AzureCDNToolkit:CdnUrl" value="https://my-cdn-url.azureedge.net" />
    

    Any ideas why CDN URL is not used?

  • SteveV 54 posts 240 karma points
    May 28, 2019 @ 14:23
    SteveV
    0

    Browsers save redirects in their cache and that might be why you are seeing a link to *.blob.core.windows.net. Open a new private/incognito browser window and check your site again.

  • Samoura 5 posts 97 karma points
    May 28, 2019 @ 16:13
    Samoura
    101

    Turns out that it was a TLS1.2-related issue. Here is the summary that makes the images come from CDN, hopefully it helps others, too.

    Install the UmbracoCms.IdentityExtensions (if you didn't already) and configure owin:startup in web.config:

    <add key="owin:appStartup" value="UmbracoStandardOwinStartup" />
    

    Edit the App_Start/UmbracoStandardOwinStartup.cs

    And add:

    public override void Configuration(IAppBuilder app)
    {
    //ensure the default options are configured
    base.Configuration(app);
    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
    ...
    }
    

    After this point the images are working as expected. The issue was identified at https://github.com/CrumpledDog/Umbraco-AzureCDNToolkit/issues/21

Please Sign in or register to post replies

Write your reply to:

Draft