CrazyGeek
CrazyGeek

Reputation: 3437

OPTION request rejected by CloudFront

Since last week I have been struggling to fix this problem but still its not resolved. I have deployed my Django code on AWS lambda and configure the API gateway to serve all api and admin section.

All http method are working fine from rest client/postman but when I am trying to integrating the api in AngularJS then try to perform the POST request to the api but Chrome sends a default OPTION request to the server but every time CloudFront returns an error with 500 status.

"Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource."

enter image description here

enter image description here Please help me to resolve the issue as I need to move my product to production.

Thanks, AbdulWahid

Upvotes: 1

Views: 1251

Answers (1)

Wonjae Lee
Wonjae Lee

Reputation: 111

Thanks to Michael-sqlbot's comment, I finally succeed to get 200 response from AWS Lambda. Just enable CORS for your Method in API Gateway then it will work.

Upvotes: 1

Related Questions