You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can host static assets in the Office 365 content delivery network (CDN) to provide better performance for your SharePoint Online pages. Static assets are files that don't change very often, like images, video and audio, style sheets, fonts, and JavaScript files. The CDN works as a geographically distributed caching proxy, by caching static assets closer to the browsers requesting them.
14
-
15
-
## Office 365 CDN basics
16
-
17
-
The Office 365 CDN is included as part of your SharePoint Online subscription. You don't have to pay extra for it. Office 365 provides support for both private and public access and allows you to host static assets in multiple locations, or origins. The Office 365 CDN is not the same as the Azure CDN. If you need more information about why to use a CDN or about general CDN concepts, see [Content delivery networks](https://support.office.com/en-us/article/Content-delivery-networks-0140f704-6614-49bb-aa6c-89b75dcd7f1f).
18
-
19
-
## Office 365 CDN types
20
-
21
-
Office 365 offers you two types of CDNs: Public and Private. Both options provide performance improvements, but each has unique attributes and advantages.
22
-
23
-
### Office 365 Public CDN
24
-
25
-

26
-
27
-
1. Administrator enables Office 365 Public CDN for the tenant.
28
-
1. Static assets to be shared from CDN are uploaded to SharePoint libraries, which are enabled as Public CDN origins.
29
-
1. Assets from the configured libraries and folders are propagated to the CDN service.
30
-
1. URLs pointing to CDN ___location are available to be used in the SharePoint sites and in customizations running on SharePoint pages.
31
-
32
-
> [!NOTE]
33
-
> You should never place resources that are considered sensitive to your organization in a Document library configured as a Public CDN origin.
34
-
35
-
#### Office 365 Public CDN attributes and advantages
36
-
37
-
- Assets exposed in a public origin are accessible by everyone anonymously.
38
-
- If you remove an asset from a public origin, the asset may continue to be available for up to 30 days from the cache; however, we will invalidate links to the asset in the CDN within 15 minutes.
39
-
- When you host style sheets (CSS files) in a public origin, you can use relative paths and URIs within the code. This means that you can reference the ___location of background images and other objects relative to the ___location of the asset that's calling it.
40
-
- While you can hard code a public origin's URL, doing so is not recommended. The reason for this is that if access to the CDN becomes unavailable, the URL will not automatically resolve to your organization in SharePoint Online and might result in broken links and other errors. Therefore, the recommendation is to use SharePoint URLs and have SharePoint automatically rewrite the URL to the public CDN URL when it's enabled.
41
-
- The default file types that are included for public origins are .css, .eot, .gif, .ico, .jpeg, .jpg, .js, .map, .png, .svg, .ttf, and .woff. You can specify additional file types by changing the [CDN's configuration](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/set-spotenantcdnpolicy?view=sharepoint-ps).
42
-
- If you want, you can configure a policy to exclude assets that have been identified by site classifications that you specify. For example, you can choose to exclude all assets that are marked as "confidential" or "restricted" even if they are an allowed file type and are located in a public origin.
43
-
44
-
### Office 365 Private CDN
45
-
46
-

47
-
48
-
1. Administrator enables Office 365 Private CDN for the tenant
49
-
1. Static assets to be shared from CDN are uploaded to SharePoint libraries, which are enabled as Private CDN origins
50
-
1. Assets from the designated Private CDN Origins are distributed to the CDN service
51
-
1. When users request pages using assets stored in any of the CDN origins, SharePoint automatically rewrites the assets' URL to the CDN URL, so that these assets are served from the CDN
52
-
1. Assets being served from the CDN must have a major version published and users must have permissions to access these assets, when URL rewriting happens
53
-
54
-
#### Office 365 Private CDN attributes and advantages
55
-
56
-
- Users can only access the assets from a private origin if they are authorized to do so. Anonymous access to these assets is prevented.
57
-
- If you remove an asset from the private origin, the asset may continue to be available for up to an hour from the cache; however, we will invalidate links to the asset in the CDN within 15 minutes.
58
-
- The default file types that are included for private origins are .gif, .ico, .jpeg, .jpg, .js, and .png. You can specify additional file types by changing the [CDN's configuration](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/set-spotenantcdnpolicy?view=sharepoint-ps).
59
-
- Just like public origins, you can configure a policy to exclude assets that have been identified by site classifications that you specify even if you use wildcards to include all assets within a folder or site library.
60
-
61
-
### Publishing feature auto-rewriting to CDN URLs
62
-
63
-
To help organizations take advantage of the Office 365 CDN capabilities without having to update their existing portals, the SharePoint Publishing feature has been updated to automatically rewrite URLs of assets stored in CDN origins to their CDN equivalents so that assets are served from the CDN service instead of SharePoint.
64
-
65
-
The following is an overview of which links are automatically rewritten by the SharePoint Publishing feature:
66
-
67
-
- IMG/LINK/CSS URLs in classic publishing page HTML responses
68
-
- This includes images added by authors within the HTML content of a page
69
-
- When extending pages, you can temporarily disable auto-rewriting URLs on a page by:
70
-
- checking out the page
71
-
- providing the query string parameter `?NoAutoReWrites=true`
72
-
- Picture Library SlideShow webpart image URLs
73
-
- Image fields in SPList REST API (RenderListDataAsStream) results
74
-
- Use the new property ImageFieldsToTryRewriteToCdnUrls to provide a comma separated list of Fields.
75
-
- Supports Hyperlink Fields (Picture or Link) and PublishingImage Fields.
76
-
- SharePoint Image renditions
77
-
78
-
## Set up and configure the Office 365 CDN
79
-
80
-
You can set up and configure the Office 365 CDN in your tenant using the SharePoint Online Management Shell or the Office 365 CLI.
81
-
82
-
### Set up and configure the Office 365 CDN using the SharePoint Online Management Shell
83
-
84
-
> [!NOTE]
85
-
> Before you can manage site collection app catalogs in your tenant, ensure that you have installed the [SharePoint Online Management Shell](https://www.microsoft.com/en-us/download/details.aspx?id=35588). Next, connect to your SharePoint Online tenant using the `Connect-SPOService` cmdlet.
86
-
87
-
#### Enable Office 365 CDN
88
-
89
-
You can manage the state of the Office 365 CDN in your tenant using the [Set-SPOTenantCdnEnabled](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/set-spotenantcdnenabled?view=sharepoint-ps) cmdlet.
90
-
91
-
To enable the Office 365 Public CDN in your tenant execute:
92
-
93
-
```powershell
94
-
Set-SPOTenantCdnEnabled -CdnType Public -Enable $true
Alternatively, if you want to use both CDN types, you can enable them using:
104
-
105
-
```powershell
106
-
Set-SPOTenantCdnEnabled -CdnType Both -Enable $true
107
-
```
108
-
109
-
If you don't want to use the standard CDN origins, add the `-NoDefaultOrigins` parameter:
110
-
111
-
```powershell
112
-
Set-SPOTenantCdnEnabled -CdnType Both -Enable $true -NoDefaultOrigins
113
-
```
114
-
115
-
#### View the current status of the Office 365 CDN
116
-
117
-
To check, if the particular type of Office 365 CDN is enabled or disabled, use the [Get-SPOTenantCdnEnabled](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/get-spotenantcdnenabled?view=sharepoint-ps) cmdlet.
118
-
119
-
To check if the Office 365 Public CDN is enabled, execute:
120
-
121
-
```powershell
122
-
Get-SPOTenantCdnEnabled -CdnType Public
123
-
```
124
-
125
-
#### View Office 365 CDN origins
126
-
127
-
To view the currently configured Office 365 Public CDN origins execute:
128
-
129
-
```powershell
130
-
Get-SPOTenantCdnOrigins -CdnType Public
131
-
```
132
-
133
-
#### Add Office 365 CDN origin
134
-
135
-
> [!NOTE]
136
-
> You should never place resources that are considered sensitive to your organization in a SharePoint Document library configured as a Public CDN origin
137
-
138
-
Use the [Add-SPOTenantCdnOrigin](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/add-spotenantcdnorigin?view=sharepoint-ps) cmdlet to define a CDN origin. You can define multiple origins. The origin is a URL that points to a SharePoint library or folder that contains the assets that you want to be hosted by the CDN.
> After adding a CDN origin, it might take up to 15 minutes for you to be able to retrieve files via the CDN service. You can verify if the particular origin has already been enabled using the [Get-SPOTenantCdnOrigins](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/get-spotenantcdnorigins?view=sharepoint-ps) cmdlet.
160
-
161
-
#### Remove Office 365 CDN origin
162
-
163
-
Use the [Remove-SPOTenantCdnOrigin](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/remove-spotenantcdnorigin?view=sharepoint-ps) cmdlet to remove a CDN origin for the specified CDN type.
164
-
165
-
To remove an origin from the Public CDN configuration, execute:
166
-
167
-
```powershell
168
-
Remove-SPOTenantCdnOrigin -CdnType Public -OriginUrl */masterpage
169
-
```
170
-
171
-
> [!NOTE]
172
-
> Removing a CDN origin doesn't affect the files stored in any Document library matching that origin. If these assets have been referenced using their SharePoint URL, SharePoint will automatically switch back to the original URL pointing to the Document library. If, however, assets have been referenced using the Public CDN URL, then these links will now be broken and will need to be manually changed.
173
-
174
-
#### Modify Office 365 CDN origin
175
-
176
-
It's not possible to modify an existing CDN origin. Instead, you should remove the previously defined CDN origin using the `Remove-SPOTenantCdnOrigin` cmdlet and add a new one using the `Add-SPOTenantCdnOrigin` cmdlet.
177
-
178
-
#### Change the types of files to include in Office 365 CDN
179
-
180
-
By default, the following file types are included in the Public CDN: _.css, .eot, .gif, .ico, .jpeg, .jpg, .js, .map, .png, .svg, .ttf, and .woff_. If you need to include additional file types in the CDN, you can change the CDN configuration using the [Set-SPOTenantCdnPolicy](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/set-spotenantcdnpolicy?view=sharepoint-ps) cmdlet.
181
-
182
-
> [!NOTE]
183
-
> When changing the list of file types, you overwrite the currently defined list. If you want to include additional file types, first use the [Get-SPOTenantCdnPolicies](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/get-spotenantcdnpolicies?view=sharepoint-ps) cmdlet to find out which file types are currently configured.
184
-
185
-
To add the _JSON_ file type to the default list of file types included in the Public CDN, execute:
186
-
187
-
```powershell
188
-
Set-SPOTenantCdnPolicy -CdnType Public -PolicyType IncludeFileExtensions -PolicyValue "CSS,EOT,GIF,ICO,JPEG,JPG,JS,MAP,PNG,SVG,TTF,WOFF,JSON"
189
-
```
190
-
191
-
#### Change the list of site classifications you want to exclude from the Office 365 CDN
192
-
193
-
Use the [Set-SPOTenantCdnPolicy](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/set-spotenantcdnpolicy?view=sharepoint-ps) cmdlet to exclude site classifications that you do not want to make available over the CDN. By default, no site classifications are excluded.
194
-
195
-
> [!NOTE]
196
-
> When changing the list of excluded site classifications, you overwrite the currently defined list. If you want to exclude additional classifications, first use the [Get-SPOTenantCdnPolicies](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/get-spotenantcdnpolicies?view=sharepoint-ps) cmdlet to find out which classifications are currently configured.
197
-
198
-
To exclude sites classified as _HBI_ from the Public CDN, execute
199
-
200
-
```powershell
201
-
Set-SPOTenantCdnPolicy -CdnType Public -PolicyType ExcludeRestrictedSiteClassifications -PolicyValue "HBI"
202
-
```
203
-
204
-
#### Disable Office 365 CDN
205
-
206
-
To disable the Office 365 CDN use the `Set-SPOTenantCdnEnabled` cmdlet, for example:
207
-
208
-
```powershell
209
-
Set-SPOTenantCdnEnabled -CdnType Public -Enable $false
210
-
```
211
-
212
-
### Set up and configure the Office 365 CDN using the Office 365 CLI
213
-
214
-
> [!NOTE]
215
-
> Before you can manage site collection app catalogs in your tenant, ensure that you have installed the [Office 365 CLI](https://aka.ms/o365cli). Next, connect to your SharePoint Online tenant using the [spo connect](https://pnp.github.io/office365-cli/cmd/spo/connect/) command.
216
-
217
-
#### Enable Office 365 CDN
218
-
219
-
You can manage the state of the Office 365 CDN in your tenant using the [spo cdn set](https://pnp.github.io/office365-cli/cmd/spo/cdn/cdn-set/) command.
220
-
221
-
To enable the Office 365 Public CDN in your tenant execute:
222
-
223
-
```sh
224
-
spo cdn set --type Public --enabled true
225
-
```
226
-
227
-
To enable the Office 365 Private CDN, execute:
228
-
229
-
```sh
230
-
spo cdn set --type Private --enabled true
231
-
```
232
-
233
-
#### View the current status of the Office 365 CDN
234
-
235
-
To check, if the particular type of Office 365 CDN is enabled or disabled, use the [spo cdn get](https://pnp.github.io/office365-cli/cmd/spo/cdn/cdn-get/) command.
236
-
237
-
To check if the Office 365 Public CDN is enabled, execute:
238
-
239
-
```sh
240
-
spo cdn get --type Public
241
-
```
242
-
243
-
#### View Office 365 CDN origins
244
-
245
-
To view the currently configured Office 365 Public CDN origins execute:
246
-
247
-
```sh
248
-
spo cdn origin list --type Public
249
-
```
250
-
251
-
#### Add Office 365 CDN origin
252
-
253
-
> [!NOTE]
254
-
> You should never place resources that are considered sensitive to your organization in a SharePoint Document library configured as a Public CDN origin
255
-
256
-
Use the [spo cdn origin add](https://pnp.github.io/office365-cli/cmd/spo/cdn/cdn-origin-add/) command to define a CDN origin. You can define multiple origins. The origin is a URL that points to a SharePoint library or folder that contains the assets that you want to be hosted by the CDN.
> After adding a CDN origin, it might take up to 15 minutes for you to be able to retrieve files via the CDN service. You can verify if the particular origin has already been enabled using the [spo cdn origin list](https://pnp.github.io/office365-cli/cmd/spo/cdn/cdn-origin-list/) command.
278
-
279
-
#### Remove Office 365 CDN origin
280
-
281
-
Use the [spo cdn origin remove](https://pnp.github.io/office365-cli/cmd/spo/cdn/cdn-origin-remove/) command to remove a CDN origin for the specified CDN type.
282
-
283
-
To remove an origin from the Public CDN configuration, execute:
284
-
285
-
```sh
286
-
spo cdn origin remove --type Public --origin */masterpage
287
-
```
288
-
289
-
> [!NOTE]
290
-
> Removing a CDN origin doesn't affect the files stored in any Document library matching that origin. If these assets have been referenced using their SharePoint URL, SharePoint will automatically switch back to the original URL pointing to the Document library. If, however, assets have been referenced using the Public CDN URL, then these links will now be broken and will need to be manually changed.
291
-
292
-
#### Modify Office 365 CDN origin
293
-
294
-
It's not possible to modify an existing CDN origin. Instead, you should remove the previously defined CDN origin using the `spo cdn origin remove` command and add a new one using the `spo cdn origin add` command.
295
-
296
-
#### Change the types of files to include in Office 365 CDN
297
-
298
-
By default, the following file types are included in the CDN: _.css, .eot, .gif, .ico, .jpeg, .jpg, .js, .map, .png, .svg, .ttf, and .woff_. If you need to include additional file types in the CDN, you can change the CDN configuration using the [spo cdn policy set](https://pnp.github.io/office365-cli/cmd/spo/cdn/cdn-policy-set/) command.
299
-
300
-
> [!NOTE]
301
-
> When changing the list of file types, you overwrite the currently defined list. If you want to include additional file types, first use the [spo cdn policy list](https://pnp.github.io/office365-cli/cmd/spo/cdn/cdn-origin-list/) command to find out which file types are currently configured.
302
-
303
-
To add the _JSON_ file type to the default list of file types included in the Public CDN, execute:
304
-
305
-
```sh
306
-
spo cdn policy set --type Public --policy IncludeFileExtensions --value "CSS,EOT,GIF,ICO,JPEG,JPG,JS,MAP,PNG,SVG,TTF,WOFF,JSON"
307
-
```
308
-
309
-
#### Change the list of site classifications you want to exclude from the Office 365 CDN
310
-
311
-
Use the [spo cdn policy set](https://pnp.github.io/office365-cli/cmd/spo/cdn/cdn-policy-set/) command to exclude site classifications that you do not want to make available over the CDN. By default, no site classifications are excluded.
312
-
313
-
> [!NOTE]
314
-
> When changing the list of excluded site classifications, you overwrite the currently defined list. If you want to exclude additional classifications, first use the [spo cdn policy list](https://pnp.github.io/office365-cli/cmd/spo/cdn/cdn-policy-list/) command to find out which classifications are currently configured.
315
-
316
-
To exclude sites classified as _HBI_ from the Public CDN, execute
317
-
318
-
```sh
319
-
spo cdn policy set --type Public --policy ExcludeRestrictedSiteClassifications --value "HBI"
320
-
```
321
-
322
-
#### Disable Office 365 CDN
323
-
324
-
To disable the Office 365 CDN use the `spo cdn set` command, for example:
325
-
326
-
```sh
327
-
spo cdn set --type Public --enabled false
328
-
```
329
-
330
-
## See also
331
-
332
-
-[Use the Office 365 content delivery network with SharePoint Online](https://support.office.com/en-us/article/use-the-office-365-content-delivery-network-with-sharepoint-online-bebb285f-1d54-4f79-90a5-94985afc6af8)
333
-
-[Video on getting started with Office 365 CDN](https://youtu.be/2kI2LnQ-3wQ?list=PLR9nK3mnD-OWSbg0o9a7mx_E7s2u7h_o2)
13
+
This page has been moved to: [Use the Office 365 Content Delivery Network (CDN) with SharePoint Online](https://docs.microsoft.com/office365/enterprise/use-office-365-cdn-with-spo).
0 commit comments