Hi Team,
i am running
DAML Json-API on localhost:7575 and
my react App on localhost:3001
I am able to get the responses from Json-API using postman
but while hitting the same url (‘http://localhost:7575/v1/query’) with react i am getting CORS issue
please find the below Screenshot and help me resolving this issue
I suspect this is due to your browser blocking these requests as it does not comply with Same-origin policy .
Specifically, your UI is running on localhost:3001 while you have the JSON API running on localhost:7575 . Browsers will block these requests by default as a security measure.
To remedy this consider using something like NGINX as a reverse proxy to make sure that your UI and the JSON API run on the same host and port or a webpack proxy as mentioned in this example.
Having the proxy there doesn’t necessarily mean your app is going through it - make sure your calls to the JSON API from your application’s code use the proxy origin rather than trying to connect directly to the JSON API origin (typically, check that your app does not use the JSON API port explicitly).