Getting the Office 365 Private CDN to work

Copper Contributor

I saw the news today and tested out the CDN feature in a SharePoint Online tenant with first release.

 

I enabled both the public and private CDNs, created libraries, and added origins.

 

I can reference items through the public CDN using the URL htts://publiccdn.sharepointonline.com/tenant/sites/site/library/item. This works great -- images download quickly (in fact they appear already on the page when the page loads in my browser) and I see they are downloaded in parallel using http 2.

 

What I can't seem to get working is the private CDN. My understanding is any links or references to assets that are in the library will get a token automatically generated but I'm not seeing this. Images in an origin library download as normal using http 1. To test I put a CEWP on a page and put a number of img tags pointing to the images in the library.

 

Publishing is enabled and the images are published (I don't think this is required but I did it none the less) and I can access the images (I uploaded them) so I know there is no permissions issue.

 

Is there a step that I'm missing? Maybe I'm not understanding how auto-rewriting works or what it applies to.

9 Replies

Hi @Jason Warren,

private CDN works automatically for publishing pages if it refers assets from the CDN origins. This is fully automatic and built in the page processing. Private CDN also works for certain web parts automatically, like defined in the blog post under "Publishing Feature Auto-Rewriting to CDN URLs".

 

Private CDN capabilities will be currently gradually enabled in the tenants using our release rings, first for first release tenants.  

 

You can see privatecdn.sharepointonline.com as prefix for the assets coming through this process.

OK.

I have a site collection with a library that is added as a private CDN origin. In the library are JPEG and PNG files. https://tenant.sharepoint.com/sites/examplesc/imageslibrary. Origin: */imageslibrary

 

I have a pages library with pages. I add a new page and on that page I add a CEWP. In the CEWP I insert an image that is stored in imageslibrary.

 

I save the page, publish it, and browse to the page. The image loads from https://tenant.sharepoint.com/sites/examplesc/imageslibrary using http/1.1

 

 

What am I missing? How do I get it to perform the automatic rewrite?

I just wanted to mention that I tried using a Private CDN only and followed the exact steps in the video and it doesn't work either.

 

I created a publishing site, added a new doc library as a Private CDN Origin - "sites/cdn/cdn" where i have a site called cdn and doc library called cdn

 

I made sure the image was published as a major version and tried a few options with the page - Page layout with image on left, and also inserting web part with image.

 

I thought it was a delay, but still after a few days the URL's for the images still show directly from SharePoint and not the Private CDN URL

 

Thanks

BUMP.

 

I am having the same issue that Jason and Steve are having.  I know the URL rewriting is *supposed* to be automatic but it is NOT working.  I watched your video, read all the blog posts carefully and followed all of the steps.

 

I've enabled CDN at the tennant and created the origins:

private_cdn_1.JPG

 

I've made sure that I've got a major version published, and that "everyone" has read permissions in the document library:

private_cdn_2.JPG

 

I've put a relative path into the image link property of the image web part on my page:

private_cdn_3.JPG

 

The page is published. Now it shows up on the page...

private_cdn_4.JPG

But NOT with the rewritten URL (i.e. it's not coming from the CDN):

private_cdn_5.JPG

 

Does a Private CDN have to be in the same site collection?  Or am I somehow misinterpreting how the Origin library path needs to be specified (either when setting it up or when attempting to consume files from it)?  Or perhaps there is something else?

 

A public CDN will be a non-starter for my client, and they don't want to do SPFx if it requires a CDN they have to pay extra for (like Azure, for example), so I really need to make the Private CDN work.

 

 

After my big-ol' post yesterday (elsewhere in this thread) I've learned a few things and managed to get this to work with assets [haven't tried to host SPFx web parts yet, that's a task for tomorrow :) ].

 

The first thing I learned was that I need to pay attention to details when I read blog posts/documentation: it's pretty clear that this is a publishing feature and I didn't have the site collection and web publishing features enabled in my SPO dev site.  That's now taken care of.

 

Additionally, I realized that while the "General availability of Office 365 CDN" post is a little unclear about it, I think the private CDN feature is still considered preview only at the moment.  I'm sure this will change soon, but in the mean time, I went to the settings page of my tenant-admin site and made sure that Preview Features setting was set to "Enable preview features".

 

The CDN now works everywhere I put the relative asset URL in a publishing page layout: in the page picture area, content area, even in a Content Editor Web Part where I have edited the HTML to have an <img> tag explicitly reference the item in the origin library.

 

Picture is now coming from the private CDNPicture is now coming from the private CDN

Yes, I noticed that finally also. In my case, I don't have the preview of Private CDN yet in my tenant even though I have it set to Preview features. I was using a publishing site likey described and had a major version published. Will have to wait for it to be GA, I guess

>> I don't have the preview of Private CDN yet in my tenant even though I have it set to Preview features.<<

 

Try again tomorrow.  I found that sometimes it takes a while for O365 to respond to changes in my tenant settings.

Yep we got it to work as well but like you said its only for images in publishing pages which is a little limiting. Ideally we would like that ability to have this available in SPFx and other web parts so that we can take advantage of the speed.

"Ideally we would like that ability to have this available in SPFx and other web parts so that we can take advantage of the speed."

 

Challenge with private CDN is the changing URL. You can though always use public CDN for the needed JS files for your client-side web parts. These are anyway static JS files, which do not contain any keys or content, so there's no risk for data leak due the anonymous nature of public CDN option.