Introducing SharePoint Framework

Test the Office365 CDN

Your browser needs to be JavaScript capable to view this video

Try reloading this page, or reviewing your browser settings

This segment demonstrates the Office 365 CDN working.

Keywords

  • Office365 CDN
  • Office 365
  • Postman

About this video

Author(s)
Sahil Malik
First online
23 November 2018
DOI
https://doi.org/10.1007/978-1-4842-3840-0_16
Online ISBN
978-1-4842-3840-0
Publisher
Apress
Copyright information
© Sahil Malik 2019

Video Transcript

Speaker: Now, after having enabled the CDN origin, I had to wait 10 or 15 minutes for that configuration pending message to go away. Notice here it says configuration pending. That was 15 minutes ago. I just ran this command and that has gone away. Let’s run it again just to make sure. And yeah, indeed. So at this point, whatever I put in SITES/CDN/CDNDOCS should be available to use as a CDN endpoint. Also, you know that I already put in a document here. It’s called sample.js. So if I look at the URL up here, let’s copy paste this and put this in notepad. So if I look at the full URL here sample.js should be available with authentication at this link here, right? Now because this document library is enabled to be used as an Office 365 CDN, that file will also now be available at this URL anonymously. Yes, you don’t need to authenticate anymore to reach this file. Let’s try.

OK. I’m going to show you this not working first. What do I mean by not working? Well, you’ll see. So I’m going to hit enter just to simple get request and it says invalid referer. What happened? Well, the thing is, Microsoft doesn’t want you to start abusing the CDN for non-SharePoint purposes. So what you need to do is that as long as the referer initially the header contains sharepointonline.com, then it will serve the file to you. So I need a tool to craft up a simple request, a get request or a rest request really, and you can get that too from getpostman.com. There are other ways to do this as well. You can use curl, for instance, but I’m just going to use Postman and I’ve already set this up here, so I’m going to go ahead and issue a simple request to this URL. publiccdn.com, sharepointonline.com are basically the same URL. But in the headers portion, I have included a header called referer and its value ends in .sharepoint.com. And now when I hit send, notice that the file is rendered. So as long as my web parts are running on .sharepoint.com, this content will get rendered. And this is how the Officer 365 CDN works. So I have a well-defined URL for my artifacts. Now it’s time to start using the Office 365 CDN.