May 11 2017 02:37 PM
May 11 2017 02:37 PM
I verified that the Private CDN works with my static assets (for example, .jpg files; see the "Getting the Office 365 Private CDN to work" thread), but using it for the web part files is apparently not so straight-forward. I followed the same instructions that are published for the Public CDN, but substituted the private URL in the cdnBasePath property in the Write-Manifests.json file like so:
All the other steps worked as expected. Everything went smoothly until I actually tried to run the thing. Placing an instance of the web part on a publishing page, the end result was this:
The web part is positively *singing* when I run it in the workbench (both local and in my dev site). Actually on a page, not so much.
What do we need to do *differently* when deploying SPFx Web Parts to a Private CDN?
May 15 2017 05:21 PM
Tried a different approach, setting the cdnbasepath to a relative URL that points to the private origin folder. The web part now shows up and operates as expected, but inspection with an F12 in the browser shows that the web part is coming directly from the SPO document library and not from the CDN.
Is it possible to have a definitive answer about whether this will work or not? Can we host SPFx web part files in a PRIVATE CDN? Is it something that is coming? Or is it never intended to work this way, with the expectation that all SPFx web parts will use a PUBLIC CDN?
The direction of my development on this current project depends on the answer. Help me Vesa-wan Kenobi, you're my only hope!
May 16 2017 02:25 AM - edited May 16 2017 02:27 AM
May 16 2017 03:02 AMSolution
You cannot deploy SPFx solutions using private CDN at least currently. This is due the fact that the private CDN URL is changing and is not static, which is needed, so that you can define web part host URL in the web part manifest.
Hopefully that clarifies the situation.
May 16 2017 05:02 PM
That is excellent information, thank you so much.
>>Client-side web part JS files only contain JS script - not secrets or actual information, so there should not be any concerns from that perspective around hosting them from public CDN<<
I will try to convince my client of this ;)
>>If you still would like to get them hosted from fully secured URL, you'd use simply directly for example library in SharePoint without any CDN capabilities <<
Yes thanks! I actually got this working yesterday. I set the cdnbasepath value to a server-relative path of the library where the bundled JS and JSON files are and it worked perfectly. My only concern was whether the performance would be adequate, but so far it looks good.
>>Hopefully that clarifies the situation.<<
It does indeed. Thanks again!