Problem Angular CORS + Protheus
I searched a few places and found nothing about it, I would like to know if anyone has 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/metodo).
However, the destination method returns with status 200, and the server response is correct, but it is giving the error:
" Access to XMLHttpRequest at ' http://localhost:9094/rest/metodo?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 appserver.ini of Protheus to accept CORS of any origin, and I do not know what else can be.
1 answers
Good afternoon.
Place this line at the beginning of your rest/ADVPL service:
::SetHeader('Access-Control-Allow-Credentials' , "true")
Abs.