1
I’ve looked in some places and I can’t find anything about it, I’d like to know if anyone’s been through it and can help me.
I am trying to make a REST request through an Angular application running on port 4200 (localhost:4200), to the Protheus server on port 9094 (localhost:9094/Rest/method).
However, the destination method returns with status 200, and the response from the right server, but is giving the error:
" Access to Xmlhttprequest at 'http://localhost:9094/Rest/method? mat=123123&pwd=123123' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested Resource. "
I have already tried to release in Protheus appserver.ini to accept CORS from any source, and I don’t know what else can be.
You can add the CORS configuration in appserver.ini in the question?
– thur
Of course, I’ve already added to the question, thank you!
– Luis Henrique Abeno
I was able to find a solution by researching a little more and I was able to make the request, but I’m not sure if this would be the definitive solution. It was necessary to configure a proxy in the application: https://medium.com/@gigioSouza/solving-the-problem-do-Cors-with-angular-2-e-o-angular-cli-7f7cb7aab3c2
– Luis Henrique Abeno
Good afternoon! You saw this: https://medium.com/@adrianonegrao/enable-Cors-to-access-servi%C3%A7os-Rest-e6a3a11db182 https://medium.com/@alexandremjacques/understanding-o-Cors-parte-8331d0a777e1
– Luciano Silva de Souza