Using Azure CDN with blob storage
# help-with-umbraco
r
Hi all. I am migrating from Umbraco 7 all the way to 12. I have a test site running and working. Now I have a blob storage account with all the media, the website display this correctly and the crops also work fine. I am trying to get the site to use a CDN I followed the guide here: https://github.com/umbraco/Umbraco.StorageProviders but for some reason my media never redirects to the CDN, not sure if I am misunderstanding how it should but I would expect all the media to now be pulling from the CDN and not directly from the website. I found the documentation on the Umbraco website lacking and same with the github page (unless I am missing something here). Any help would be great.
d
Hi there! From what I understand, the cdn url provider should cause your media items to render absolute urls with the cdn domain in your razor page, so if you don't have cdn urls in your razor page, that's likely where it goes wrong. Your CDN should then also point to your website. You shouldn't see any redirects at all in Umbraco 12
r
Thank you for the reply. That makes sense, the images are still not pointing at the CDN. They still have the website domain instead of the CDN. Not sure what I am missing.
d
Do you have the method call
.AddCdnMediaUrlProvider()
in your Startup.cs file? And have you configured the options for it as well, either by code or in appsettings.json?
r
Just checking and yes, I have .AddAzureBlobMediaFileSystem() .AddAzureBlobImageSharpCache() .AddCdnMediaUrlProvider() and the appsettings has the correct config.
d
You could try and configure the cdn url in code, just to see if that makes a difference 🤷
r
I have also tried that and also makes no difference. Its very weird, I thought this should just work. From the CDN side is there any specific CDN I need to use? Any settings you know of that I might be missing?
Looks like its working to some degree, I have an API call that grabs some nodes and the URL returns the CDN but the website media section still doesnt?
d
I don't know how the media section grabs image urls
r
Hmm, its so odd. My Umbraco 7 site seems to work fine with the CDN but 12 seems to be working much differently. Really not sure what the issue is. I guess I will keep investigating.
6 Views