Request to tigergraph api being blocked by CORS policy

I’m trying to get all the vertices from tigergraph and I’m using this URL as a requested endpoint.
I am able to achieve what I want in postman, but the same results are not achievable in the application. Here is the setting I applied in the Nginx configuration in TG Cloud.

Access-Control-Allow-Origin: http://localhost:3000

Access-Control-Allow-Methods: GET, POST, OPTIONS, HEAD, DELETE

Access-Control-Allow-Headers: Content-Type, Authorization

And here is the error I am getting when I try to hit the endpoint from my application which is using react.
MicrosoftTeams-image (1)

please tell me how can I move forward with this.

Hi @abdulaffou! Have you added CORS enabling code on the server-side of your application?

@abdulaffou This resource might be of help too:

We are not using a server-side application, instead, we are planning to use the tigergraph rest API as a sole backend.
Is there any way to resolve this issue through tigergraph cloud.
Thank you

Hi @abdulaffou,

Unfortunately there is no way to get around CORS with TG Cloud currently. You can disable CORS restrictions on an on-prem solution by following this guide, but the functionality is currently not supported in Cloud.

@abdulaffou Just following up to see if the guide was helpful to navigate your current blocker.

We migrated from cloud instance to local instance. It is working fine now.

2 Likes