Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Office 365 Public CDN not working #491

Closed
harshdamaniahd opened this issue Apr 25, 2018 · 17 comments

Comments

Projects
None yet
4 participants
@harshdamaniahd
Copy link

commented Apr 25, 2018

I have a site tenant.sharepoint.com
In this site in "SiteAssets" Library , I have created a folder called webpart where I am hosting all files from SPFX temp folder
here are my cdn defined.
Get-SPOPublicCDNOrigins
image

This is my cdn path : "cdnBasePath": "https://publiccdn.sharepointonline.com/tenantname.sharepoint.com/SiteAssets/Webpart/"

When i build and upload my webpart , I see the it is not able to get these files.
Can you pls tell me what I am missing

@waldekmastykarz

This comment has been minimized.

Copy link
Member

commented Apr 25, 2018

Is there any reason why you are setting it all up manually, rather than having the SharePoint Framework package the scripts inside the .sppkg file and deploy them to the Office 365 CDN for you? This is by the way the default behavior, if you're using SharePoint Framework v1.4.1. Which version are you using?

@harshdamaniahd

This comment has been minimized.

Copy link
Author

commented Apr 25, 2018

Yes I am using v1. 4.1.. No specific reason.I was trying the approach of making document library as cdn

@waldekmastykarz

This comment has been minimized.

Copy link
Member

commented Apr 25, 2018

The challenge with doing it manually is, that in case the admin would turn off the Office 365 CDN, your web part wouldn't work anymore. When doing it automatically, SharePoint will automatically fallback to the document library URL when the CDN is disabled.

You could try to see if you could achieve the same result, by pointing to the document library URL rather than the CDN URL. Still, if you're deploying files to SharePoint, you could better follow the default behavior and have the SPFx toolchain include them in the package and have SharePoint deploy them automatically for you.

@harshdamaniahd

This comment has been minimized.

Copy link
Author

commented Apr 25, 2018

@waldekmastykarz actually i am pointing to document library but it is not working.
https://publiccdn.sharepointonline.com/tenantname.sharepoint.com/SiteAssets/Webpart/
This is my root site

@waldekmastykarz

This comment has been minimized.

Copy link
Member

commented Apr 25, 2018

You're using the Office 365 Public CDN URL: https://publiccdn.sharepointonline.com/.... Could you try using https://tenantname.sharepoint.com/SiteAssets/Webpart/ instead?

@harshdamaniahd

This comment has been minimized.

Copy link
Author

commented Apr 26, 2018

Normal document library works..But i was trying to make document library as cdn and it didnot work
I followed this article
https://blog.mastykarz.nl/publish-sharepoint-framework-client-side-web-parts-office-365-public-cdn/

@waldekmastykarz

This comment has been minimized.

Copy link
Member

commented Apr 26, 2018

@harshdamaniahd the steps outlined in my article were necessary in the past, when SharePoint didn't offer native support for deploying assets to the Office 365 CDN. Today however it does, so there is no true need to set it all up manually anymore.

Still, a manually setup CDN should work. Can you verify that your files stored in the webpart folder are accessible through the public CDN using the publiccdn.ashx handler as described in my article?

@harshdamaniahd

This comment has been minimized.

Copy link
Author

commented Apr 27, 2018

Yes they are accessible

@waldekmastykarz

This comment has been minimized.

Copy link
Member

commented Apr 27, 2018

What if you set https://tenantname.sharepoint.com/SiteAssets/Webpart/ as the base URL in your project: can you see SharePoint loading your web part files? If so, does it use the URL you specified or does it automatically replace it with the CDN URL?

@harshdamaniahd

This comment has been minimized.

Copy link
Author

commented Apr 28, 2018

Yes if i use https://tenantname.sharepoint.com/SiteAssets/Webpart/ as my baseurl , it loads file from the baseurl location.
It does not use cdn url .
Also i checked in postman and tried to fetch file from cdn it gives me the error
image

@waldekmastykarz

This comment has been minimized.

Copy link
Member

commented Apr 28, 2018

This seems to be similar to SharePoint/sp-dev-docs#1731

@harshdamaniahd

This comment has been minimized.

Copy link
Author

commented Apr 29, 2018

I guess there is no solution as of now, the issue is tenant specific.

@harshdamaniahd

This comment has been minimized.

Copy link
Author

commented May 17, 2018

In my new tenant when i try to access json file from document library , i get the below error
image

CDN is enabled
image

@hbgeorgian

This comment has been minimized.

Copy link

commented May 17, 2018

The CDN is restricted to accept requests coming from SharePoint.com only. It won't work from postman unless you tweak the origin

@harshdamaniahd

This comment has been minimized.

Copy link
Author

commented May 17, 2018

This is working for files with extension css,txt
image

but not with json it gives error "403 FORBIDDEN"

@VesaJuvonen

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2018

Since this seems to be a generic issue and NOT related on any sample in this repository, moving to the sp-dev-docs issue list at http://aka.ms/spdev-issues.

@VesaJuvonen

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2018

This issue was moved to SharePoint/sp-dev-docs#2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.