I’ve been trying to connect my react .js file to the back end. I have a API in API Gateway and I created a method and enabled CORS and gave it access
method.response.header.Access-Control-Allow-Headers 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'
method.response.header.Access-Control-Allow-Methods 'OPTIONS'
method.response.header.Access-Control-Allow-Origin '*'
I even tried the http://localhost:3000 for the Access-Control-Allow-Origin
but every-time I run this code and check the console I’m getting the error
Access to fetch at
https://mdksmdk.execute-api.us-east-5.amazonaws.com/blehxajkhnd
from originhttp://localhost:3000
has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
I’ve enabled the CORS multiple times. Idk what could be the issue
I can paste the code if that helps