Skip to content Skip to sidebar Skip to footer

Api Gateway Cannot Allow Access-Control-Allow-Origin

This url is in AWS API Gateway with method get and stage is well deployed. And I enabled CORS following the aws document. Here are my steps to enable CORS. -Resource->action->

Solution 1:

After consulting and trying each method, I found the error as following.

According to AWS document, we can not deploy our api before enabling CORS. All the settings about the header and CORS must be set before being deployed. But the API Gateway does not block this setting nor does it show any error dialog. API Gateway will not change the header even if your setting process shows success.


Solution 2:

The cross origin problem is from server side not javascript side. When the server does not allow request from other domains it throws cross origin error. But you said you already added CORS in aws instance

As the javascript is only accessing the service from my.com, You need to added proper domain mapping in your my.com site to tell that request will come from another domain called example.com. might be the server is not properly configured. or try if server is expecting any header.

try to see the result in any rest client like soapui, rect client plugin in chrome, etc. once you confirm that there is no problem in server, try it from javascript

To test there is a chrome plugin you can try

https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en


Post a Comment for "Api Gateway Cannot Allow Access-Control-Allow-Origin"