CORS problems in Chrome

%3CLINGO-SUB%20id%3D%22lingo-sub-2128596%22%20slang%3D%22en-US%22%3ECORS%20problems%20in%20Chrome%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2128596%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20I%20have%20taken%20one%20of%20the%20SPFx%20webparts%20in%26nbsp%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOlivierCC%2Fspfx-40-fantastics%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Espfx-40-fantastics%3C%2FA%3E%26nbsp%3Bthe%20newsCarousel%20and%20implemented%20it%20in%20our%20SharePoint%202019%20onprem%20farm.%3C%2FP%3E%3CP%3ENo%20problems%20building%2C%20shipping%20or%20deploying%20it.%20It%20works%20as%20expected%20on%20the%20server%20side%2C%20and%20in%20IE%20and%20Edge.%20It%20also%20works%20in%20the%20same%20domain%20in%20Chrome.%20Example%3A%3CBR%20%2F%3EThe%20appcatalog%20is%20%3CA%20href%3D%22https%3A%2F%2Fappcatalog.mydomain.something.com%2C%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fappcatalog.mydomain.something.com%2C%3C%2FA%3E%26nbsp%3Bthe%20intranett%20is%20%3CA%20href%3D%22https%3A%2F%2Fintranett.mydomain.something.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fintranett.mydomain.something.com%3C%2FA%3E%26nbsp%3B(just%20as%20an%20example)%3C%2FP%3E%3CP%3EHowever%20the%20farm%20is%20set%20up%20with%20hostnamed%20site%20collections%2C%20and%20we%20have%20a%20site%20called%20%3CA%20href%3D%22https%3A%2F%2Fintranett.otherdomain.anotherthing.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fintranett.otherdomain.anotherthing.com%3C%2FA%3E.%20When%20adding%20the%20webpart%20to%20this%20site.%20I%20see%20CORS%20errors%20in%20the%20console%2C%20and%20message%20in%20the%20webpart%20about%20certificate.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20I%20am%20pretty%20sure%20this%20is%20Chrome%20and%20CORS%20policy.%20However%20since%20I%20am%20not%20really%20a%20developer%2C%20just%20like%20thinkering%20with%20stuff.%20I%20am%20not%20sure%20how%20to%20buypass%20this.%20I%20have%20found%20a%20lot%20of%20articles%2C%20but%20I%20am%20not%20sure%20how%20to%20implement%20them%20like%20step%20by%20step%20(for%20dev%20dummies).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20someone%20could%20give%20me%20some%20advice%20I%20would%20be%20grateful.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi, I have taken one of the SPFx webparts in  spfx-40-fantastics the newsCarousel and implemented it in our SharePoint 2019 onprem farm.

No problems building, shipping or deploying it. It works as expected on the server side, and in IE and Edge. It also works in the same domain in Chrome. Example:
The appcatalog is https://appcatalog.mydomain.something.com, the intranett is https://intranett.mydomain.something.com (just as an example)

However the farm is set up with hostnamed site collections, and we have a site called https://intranett.otherdomain.anotherthing.com. When adding the webpart to this site. I see CORS errors in the console, and message in the webpart about certificate.

 

So I am pretty sure this is Chrome and CORS policy. However since I am not really a developer, just like thinkering with stuff. I am not sure how to buypass this. I have found a lot of articles, but I am not sure how to implement them like step by step (for dev dummies).

 

If someone could give me some advice I would be grateful.

0 Replies