Hey there stackoverflow community, I am trying to setup an aws API Gateway that links to a nodeJS app running on EC2 instance, it works fine with postman or a direct url link, but won't work when the API is called from my reactjs app (using axios), even running locally. I obviously enabled CORS as follow in my API Gateway and deployed it:
I tried every answers given on stackoverflow, but most of them are using lambda, maybe I need to do something else for EC2? What am I missing? is there something I need to add to my axios params maybe? it returns a 200 non the less however, which is wierd the exact message is : Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://xxxxxxxx.execute-api.us-east-2.amazonaws.com/OfficialBackend/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
thanks in advance
I also tried suggestion given to me by mah517, I still get a CORS, even though it returns a 200 with the actual message, which is wierd
I've encountered the same issue in the recent times. Just make a small addition in the method response and integration response.I'll be attaching the ss.