Forum Discussion
Getting Refused to connect to X because it violates the following Content Security Policy directive
Hi again,
Doesn't seem to catch much traction this post.
In the meantime, I have continued trying many different approaches; jquery, ajax, request header settings, response header settings, separating the call to another file etc., still same result.
Currently I am at this code in component.tsx:
Providing following error in Console:
I have set the response header in Logic Apps to the following, including access-control-allow-origin: *:
Picking up inspiration from another custom visual by acterys, I can see that they succeed on making use of http request from custom visual, and from the look of the response it seems to be a regular ajax request.
Meaning it IS posssible to make http request from custom visuals...? But what am I missing regarding CORS, headers, incompatible API using Logic Apps, CSP settings?
Hoping someone in the community can help 🙂
You got a 200 back. That's great.
So what exactly is your challenge?
The only think to do is to set the whitelisted web-urls in capabilities.json "privileges". Your own servers and all of the microsoft services as well.
- LasseMr3 years ago
Advocate II
Hi pbn ,
The 200 I got back was a test with another visual from appsource, demonstrating that it is indeed possible to use fetch requests within custom visuals and sandboxed iframe.
You are very right, it was just a question of getting the privileges set right it terms of whitelisting, when I got the servers in the requests went straight through!
Thanks, I do not seem to find an actual answer that I can accept from you, can you provide one? 😉
Have a great day.
- pbn3 years agoFrequent Visitor
I really want to help you if I can. However, I don't understand your question. Where is your knowledge gap?