Do I need a webscript to call external rest server (CORS)?
I try to access another Rest service outside from Alfresco via ADF. Everytime I try to execute the call. I get the following error:
Access to XMLHttpRequest at 'https:/host/endpoint' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
If I try to access it with Postman it works properly. That sounds for me, that ADF forces to use a repository webscript to access external resources. Is this correct? If not can somebody give me a hint?
Re: Do I need a webscript to call external rest server (CORS)?
Thanks for the answer, but my question was more about the external rest service I want to call which is not running in Alfresco. Is it possible to access this external rest service directly, because I always get the CORS error, or do I need to access it over a webscript?
If it is an external resource (like in not a company resource), why isn't CORS already enabled on the resource? CORS needs to be configured on the external service, not on in ADF/Angular. Adding a CORS header client side won't help you. You always could proxy that resource (that's basically what proxy.conf.js does), but if CORS isn't present, are you allowed to consume that resource in that way?