Büro 365 Content Delivery Network available. Company also announcing preview for the completely new Publishing Feature Auto-Rewrite integration along with Private CDN. Büro 365 Public CDN is now updated and fully available for first release tenants, with gradual release for normal tenants.
Büro 365 Public CDN Overview
Following picture defines the logical flow with Büro 365 Public CDN
1. Administrator enables Büro 365 Public CDN for the tenant using SharePoint Online Management Shell.
2. Static assets to be shared from CDN are uploaded to the SharePoint libraries, which are enabled as CDN origins.
3. Assets are being exposed from the configured libraries and folders and they can be accessed using CDN URLs.
4. URLs pointing to CDN location are available to be used in the SharePoint sites and in the customizations hosted from SharePoint.
Public CDN URLs for the assets are static and are not changed after the asset has been located to the CDN origin. You can either hard-code Public CDN URLs or leverage the Publishing Feature integration to get Auto-Rewriting to CDN URL.
Büro 365 Private CDN with Publishing Auto-Rewriting Overview
Following picture defines the logical flow with Büro 365 Private CDN, which is now in preview status and available from tenants with first release status.
1. Administrator enables Büro 365 Public CDN for the tenant using SharePoint Online Management Shell
2. Static assets to be shared from CDN are uploaded to the SharePoint libraries, which are enabled as CDN origins
3. Assets are available for being exposed through the CDN service when they are in the CDN origin for the Private CDN
4. When pages, with assets in the CDN origins, are being requested, SharePoint automatically rewrites the URLs point to the CDN URLs, so that client side browser is requesting these assets using CDN location
5. Assets being shared from the CDN origin must have a major version published and user access to these assets is being considered when the URL rewriting happens
The Private CDN URLs are dynamically generated by SharePoint Online. The Private CDN URL can only be generated if user has read permissions to the CDN origin (specifically the folder containing the asset). The Private CDN Urls contain tokens on the query string that are used to grant access to the asset. Having the Private CDN Url (with the tokens) is similar to having the asset itself. The tokens used to grant access are will expire after 1 hour. We ensure that the same asset will generate the same tokens across multiple requests with that 1 hour, this allows the browser cache to be leveraged during a user session.
Publishing Feature Auto-Rewriting to CDN URLs
One of the key scenarios we see for the Public / Private CDN feature is Intranet Portals. These sites often have lots of custom JS, CSS and Images. The Public / Private CDN feature will help improve the latency of these sites because the CDN assets are geo distributed so they are cached closer to the user and the CDN Domain supports the HTTP/2 protocol which provides parallel downloading. This means we are no longer limited to 6 ports per Domain like with HTTP/1.1.
To help customers take advantage of the CDN features without needing to rewrite their existing Portals, we integrated the Publishing Feature with the Public/Private CDN Feature. The Auto-Rewriting is also required to use the Private CDN features as those Urls are dynamically generated and cannot be hard-coded like Public CDN URLs.
Here is a summary of what Publishing Auto-Rewriting supports today for assets that are in CDN Origin Libraries.
- IMG/LINK/CSS URLs in the classic publishing page HTML Response are rewritten to CDN Urls.
- This includes Images added by authors in the HTML Content of a Page. This is a great scenario for Private CDN Origins.
- To enable developer scenarios where you do NOT want CDN urls, you can disable them by:
- Check out the Page (we do not rewrite when the page is checkout to the current user)
- provide the query string parameter? NoAutoReWrites=true
- Content By Search WebPart assets is rewritten to CDN URLs.
- Display Templates JS files
- Images in Query Results – We currently support the following OOTB Managed Properties, (PictureUrl, PictureThumbnailUrl, PublishingImage)
- Picture Library SlideShow web part image URLs are rewritten to CDN URLs.
- Image fields in SPList REST API (RenderListDataAsStream) results being rewritten to CDN Urls.
- Use the new property ImageFieldsToTryRewriteToCdnUrls to provide a comma-separated list of Fields.
- Supports Hyperlink Fields (Picture or Link) and PublishingImage Fields.
- SharePoint Image renditions are supported and will translate to CDN URL.
If you have suggestions for other features or web parts you would like to support CDN Auto-Rewriting, let us know and we will add them to our backlog.
New PowerShell cmdlets for CDN management
We have collected a lot of feedback during the developer preview stage and have adjusted the implementation also on the PowerShell cmdlet side accordingly. Here are the new cmdlets related to the CDN capability.
Get / Set-SPOTenantCdnEnabled
Enables private or public CDN using default settings. Can be also used to disable private or public CDN.
Notice that when you are enabling CDN, it will be default enable default origins for the specific CDN type. If you do not want to do this, you can use -NoDefaultOrigins parameter when you execute Set-SPOTenantCdnEnabled cmdlet.
Get / Add /Remove-SPOTenantCdnOrigin(S)
Can be used to Get, Add and Remove CDN origins. Origins now support wildcards prepended to the Url. This allows you to create Origins that apply across sites. Zum Beispiel, an origin of “*/masterpage” would make the Master Page Gallery in all Sites available as CDN Origins.
- Der */ can only be present at the beginning of the path, matching any number of URL segments.
- The path does NOT have to be pointing to a doc library. If someone wanted to enable */site1, they can do so, and it will match all the doc libraries under the site.
Get-SPOTenantCdnPolicies
Can be used to see current settings around the CDN policies for both public and private CDN. This cmdlet will return the current configuration for the tenant policies.
Set-SPOTenantCdnPolicy
Can be used to configure tenant policies for both public and private CDN. You can use this one cmdlet for controlling the following settings:
- IncludeFileExtensions – File extensions that are enabled for CDN capability
- ExcludeRestrictedSiteClassifications – You can use this to control possible exclusions for the CDN usage based on site classification (Site.Classification). This is useful when you are using wildcard origins, but want to exclude some sites from being CDN origins.
- ExcludeIfNoScriptDisabled – Can be used to exclude CDN capability if the NoScript setting is disabled. This feature is still in testing and is not enabled at the time of writing this Post.
Using Office 365 CDN in SharePoint Online
Here are the steps to get started with the Büro 365 CDN.
- Make sure that you are using the latest version of SharePoint Online Management Shell
- Connect to your SharePoint Online tenant with PowerShell
Connect-SPOService -Url https://*.sharepoint.com
- Get the status of the CDN settings from the tenant level
Get-SPOTenantCdnEnabled -CdnType Public / Private
- Enable CDN in the tenant
Set-SPOTenantCdnEnabled -CdnType Public / Private
...
Public CDN enabled locations:
*/MASTERPAGE
*/STYLE LIBRARY
- Disable CDN in the tenant
Set-SPOTenantCdnEnabled -CdnType Public / Private -Enable $false
- Get the default configuration of your public CDN settings
Get-SPOTenantCdnPolicies -CdnType Public
...
Key Value
--- -----
IncludeFileExtensions CSS,EOT,GIF,ICO,JPEG,JPG,JS,MAP,PNG,SVG,TTF,WOFF
ExcludeRestrictedSiteClassifications
ExcludeIfNoScriptDisabled False
- Add new CDN origin
Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl sites/cdn/cdn
...
Public CDN enabled locations:
*/MASTERPAGE
*/STYLE LIBRARY
SITES/CDN/CDN (configuration pending)
- See the list of CDN origins
Get-SPOTenantCdnOrigins -CdnType Public
...
*/MASTERPAGE
*/STYLE LIBRARY
SITES/CDN/CDN
- Remove CDN origin
Remove-SPOTenantCdnOrigin -CdnType Public -OriginUrl sites/cdn/cdn
...
Public CDN enabled locations:
*/MASTERPAGE
*/STYLE LIBRARY
Usage of Public CDN in SharePoint pages and in customizations
Assets hosted in public CDN origins can be accessed using a well-known URL structure, which can be then referenced in your customizations, for example as a hosting location for your SharePoint Framework client-side web part JavaScript files.
The format of the public CDN URL is following
host name>/sites/site/library
You cannot use private CDN URLs automatically in your customizations since these URLs are dynamically generated by SharePoint.