API网关:无法启用CORS

问题描述:

我无法在我的API网关实例上启用CORS,这是它的外观:

I can't Enable CORS on my API Gateway instance, this is how it looks:

1.设置:

2.结果:

我已经尝试了很多方法,例如检查DEFAULT 4XXDEFAULT 5XX并按照某些帖子中的建议手动输入Access-Control-Allow-Methods.

I've tried a bunch of things like checking the DEFAULT 4XX and DEFAULT 5XX and manually inputting the Access-Control-Allow-Methods as suggested in some posts.

如果我将鼠标悬停在错误上,则会得到:Invalid Response status code specified.

If I hover over the error I get: Invalid Response status code specified.

我可以使用浏览器进行GET,但只能通过Postman进行POST.我的ReactJS网站也不会发布,并抛出:

I'm able to GET using my browser but POST can only be done from Postman. My ReactJS website won't post either, throwing:

Access to XMLHttpRequest at <ENDPOINT> from origin <S3-REACT-BUCKET> has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

我读到我有我的React应用程序应该发送CORS标头(还没有发送),但是我什至无法在API网关中启用CORS!

I've read that I have my React app should send the CORS headers (haven't got to that) but I can't even Enable CORS in the API Gateway!

那是因为没有方法响应