API Gateway "Failed to load ... No 'Access-Control-Allow-Origin' header is present on the requested resource."

  • c4016675
    (냉장고를사다줘)
  • c4016675's Avatar 이 글의 작성자
  • Offline
  • Junior
  • Junior
더보기
22 Apr 2018 18:11 - 22 Apr 2018 18:14 #3367 작성자: c4016675
c4016675 님의 글: API Gateway "Failed to load ... No 'Access-Control-Allow-Origin' header is present on the requested resource."
API Gateway 리소스를 억세스하려고 할 때,

Failed to load http://.......amazonaws.com/prod/most-hits: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

해결책은 API Gateway의 해당 API에서 [Enable CORS] 적용한다.

그러면 화면에 이런게 뜬다.

✔ Create OPTIONS method
✔ Add 200 Method Response with Empty Response Model to OPTIONS method
✔ Add Mock Integration to OPTIONS method
✔ Add 200 Integration Response to OPTIONS method
✔ Add Access-Control-Allow-Headers, Access-Control-Allow-Methods, Access-Control-Allow-Origin Method Response Headers to OPTIONS method
✔ Add Access-Control-Allow-Headers, Access-Control-Allow-Methods, Access-Control-Allow-Origin Integration Response Header Mappings to OPTIONS method
✔ Add Access-Control-Allow-Origin Method Response Header to GET method
✔ Add Access-Control-Allow-Origin Integration Response Header Mapping to GET method
Your resource has been configured for CORS. If you see any errors in the resulting output above please check the error message and if necessary attempt to execute the failed step manually via the Method Editor.
Time to create page: 0.050 seconds
Powered by Kunena Forum