Skip to content Skip to sidebar Skip to footer

Aws Api Gateway Cors Issue - Js

Im experiencing abit of problem with CORs request and im not sure what im doing wrong. I use the following code to post to my API Gateway in AWS and its coming back with the follow

Solution 1:

This post should help you enable CORS on your API gateway

https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html

  1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway.

  2. In the API Gateway console, choose an API under APIs.

  3. Choose a resource under Resources. This will enable CORS for all the methods on the resource. Alternatively, you could choose a method under the resource to enable CORS for just this method.

  4. Choose Enable CORS from the Actions drop-down menu.

    • Choose Enable CORS
  5. In the Enable CORS form, do the following:

    • In the Access-Control-Allow-Headers input field, type a static string of a comma-separated list of headers that the client must submit in the actual request of the resource. Use the console-provided header list of Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token or specify your own headers.

    • Use the console-provided value of '*' as the Access-Control-Allow-Origin header value to allow access requests from all domains, or specify a named domain to all access requests from the specified domain.

    • Choose Enable CORS and replace existing CORS headers.

  6. In Confirm method changes, choose Yes, overwrite existing values to confirm the new CORS settings.

Post a Comment for "Aws Api Gateway Cors Issue - Js"