Krasnal
Krasnal

Reputation: 85

Where to add Access-Control-Allow-Origin using ReactJS?

When I try fetch data from localhost:5000 (my api is at localhost:8080) i have an error:

Fetch API cannot load http://localhost:5000/users/1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8080' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I know that i must add header Access-Control-Allow-Origin: * but i don't know where. I'm using JS+Python (ReactJS and Flask frameworks)

Upvotes: 0

Views: 1085

Answers (1)

Parag Diwan
Parag Diwan

Reputation: 3918

You will have to add in your web server whichever you're using ; provided that you are taking security risk.

Upvotes: 0

Related Questions