When setting up the SPO Public CDN using PnP PowerShell, a 403 error shows when trying to access the URL. It shows an HTTP address instead of an HTTPS address. In SPfx, a 406 error shows from a JS fetch call.

Here's the setup process:

  1. Connect-PnPOnline -Url https://tenant.sharepoint.com/sites/SiteName
  2. Set-SPOTenant -PublicCdnEnabled $true
  3. Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl "Sites/SiteName/SiteAssets/CDN"
  4. Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl "Sites/SiteName/CDN"
  5. Upload test.css to https://tenant.sharepoint.com/sites/SiteName/CDN/Files/
  6. Make a public link to the file.
  7. Upload test.css to https://tenant.sharepoint.com/sites/SiteName/SiteAssets/CDN/Files/
  8. Make a public link to the file.
  9. Browse to https://tenant.sharepoint.com/_vti_bin/publiccdn.ashx/url?itemurl=https://tenant.sharepoint.com/SiteName/CDN/Files/test.css
  10. Capture returned URL: https://publiccdn.sharepointonline.com/tenant.sharepoint.com/1937006161eeae8fe.../Files/test.css
  11. Browse to https://tenant.sharepoint.com/_vti_bin/publiccdn.ashx/url?itemurl=https://tenant.sharepoint.com/SiteName/SiteAssets/CDN/Files/test.css
  12. Capture returned URL: https://publiccdn.sharepointonline.com/tenant.sharepoint.com/2347006161eeae8fe.../Files/test.css
  13. Browser to public CDN: https://publiccdn.sharepointonline.com/tenant.sharepoint.com/1937006161eeae8fe.../Files/test.css
  14. Get HTTP 403 error:

Access Denied

You don't have permission to access "http://publiccdn.sharepointonline.com/tenant.sharepoint.com/1937006161eeae8fe.../Files/test.css" on this server. (shows HTTP instead of HTTPS)

Reference #18.2eec3817.1654696621.25fdf7ed

The same error happens for the SiteAssets public link. Why is SPO forcing HTTP on public CDNs?

I also tried the following commands, which provided the same results:

Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl "Sites/SiteName/SiteAssets/CDN"

Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl "Sites/SiteName/CDN"

Also tried making public links to the CDN folder and Files folder.

Documentation says you can only access the URL from within SPO, but in an SPfx solution, trying to access a public CDN URL renders an HTTP 406 error. Here are two GitHub tickets that have not been resolved that are exactly related:



I'm really trying to get JSON data, and have tried to fetch the data as a MIME file JSON, CSS, TXT, and JPG. A different project allows me to use PNPjs to fetch JSON from a SP document library. This public CDN approach to allow data to pull centralized JSON into multiple extranet client sites has me stomped.

1 Answer 1


I had the same issue and I think the "Access Denied" error is misleading. It was a "referer" related issue and looks like the message used to be "Invalid referer.". I used Postman to send a GET request after including the following KEY and VALUE within the headers and successfully got the file back.

KEY: Referer
VALUE: https://tenantname.sharepoint.com

And here is the URL of my GET request: https://publiccdn.sharepointonline.com/tenantname.sharepoint.com/sites/cdn/MyDocLib/Sample.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.