Office 365 Public CDN Developer Preview Release

Vesa Juvonen - Published September 22, 2016

We are happy to announce availability of Office 365 Public Content Delivery Network (CDN) capability in the Office 365. This capability will enable you to automatically host static assets, like images and JavaScript files in CDN for providing better performance with SharePoint pages. CDN will work effectively as a geo-distributed caching proxy, by caching the static assets closer to the browsers requesting them.

Office 365 Public CDN is now released as a Developer Preview for all tenants in Office 365. You can start using it by explicitly enabling the capability on the tenant level using PowerShell cmdlets.

Following picture clarifies the logical flow of using Office 365 Public CDN.

Cmdlets allow to designate certain SharePoint document libraries or folders to serve as a CDN origin. Note, that assets exposed via Public CDN are accessible by everyone anonymously. Therefore, resources that are considered sensitive by the company should never be placed in those libraries.

Cmdlets also provide capability to choose the file types exposed via CDN. By default, common design asset types are enabled.

Static assets to be shared via CDN are being uploaded to the SharePoint libraries or folders, which are enabled as the CDN origins.

Assets are being exposed from the configured libraries of folders and they can be accessed using the CDN URLs.

URLs pointing to CDN location are available to be used in the SharePoint sites and in the customizations hosted from SharePoint.

In case the asset is updated in the SharePoint library, the new version will become available via CDN within 15 minutes.

> Notice. During developer preview, you will need to explicitly update the URL of shared assets in the pages and in the customizations to match CDN URL addresses. We are however working on doing this automatically with updated version, which is planned to be available later this calendar year before full worldwide release.

Video on using Office 365 Public CDN

Following videos shows in practice the steps to get started with the Office 365 Public CDN.

You can use Remove-SPOPublicCdnOrigin cmdlet for removing CDN locations based on the location identity

Remove-SPOPublicCdnOrigin -Identity 1937006161eeae8fe7159…

> Notice. It can take up to 15 minutes for the configuration changes to get reflected.

Usage in SharePoint pages and customizations

During developer preview of this capability, you’ll need to explicitly update the used asset links and replace them with CDN URLs. The CDN URL can be easily constructed for all the assets in the enabled library of folder, you will need to use the REST API for getting prefix for one of the assets in library/folder and use that as the constant for other assets.

The structure of CDN URL is following.

https://publiccdn.sharepointonline.com/<tenant host name>/<ID of the public CDN origin>/<sub-path under the origin>

REST API to get public CDN URL for the static asset

The original URL will be returned if asset does not belong in any of the CDN enabled libraries, or file type is not enabled to be exposed via CDN.

Notice. You can’t use a browser tab to test the URL returned by this API, due to the referer limitations in the CDN. You can set this URL to an asset hosted in SharePoint to validate the URL and that everything works properly

Frequently asked questions

Is there a cost associated on the CDN usage?

No. This CDN capability is included as a standard service as part of your Office 365 subscription at least during the developer preview with no additional costs involved. We are evaluating the future options based on usage models.

Can I use this CDN from outside of SharePoint Online?

No. There is referrer limitation on the CDN URL requests. You can only reference assets from the CDN URLs when request is coming from the SharePoint Online.

How to validate CDN URL in Fiddler?

You can perform CDN URL validation in Fiddler if you include correct referrer header for your request.

Add header “Referer: https://contoso.sharepoint.com” to the GET request

Is the content published to CDN secured?

Content published through the Public CDN is available to everyone anonymously. We are considering providing additional options for secure content with following releases.

Once the assets are published to the library, how soon can they be accessed via CDN?

New assets added to the library can be retrieved using CDN URL immediately. However, if the assets are updated, it can take up to 15 minutes for the new version to be available via CDN URLs.

If I update my assets in the SharePoint site, will they automatically be refreshed in CDN?

Yes. You changes will be automatically reflected with the CDN URLs.

Can I manually construct the URL for the static assets?

The prefix is shared for all the items in the library / folder, so you can easily reuse the prefix cross all assets stored in same library / folder after getting the initial URL using the REST API to get public CDN URL for the first static asset.

https://publiccdn.sharepointonline.com/<tenant host name>/<ID of the public CDN origin>/<sub-path under the origin>