hello:
handler: handler.hello
events:
- http:
path: /hello
method: get
cors: true
authorizer: aws_iam
我还使用awscognito来授权登录的用户。相同的用户凭据适用于其他无服务器服务,但适用于此服务。我们正在发送正确的响应头以及一些其他解决方案中提到的。我几乎试过了所有能找到的东西。
Access to fetch at 'https://*******.execute-api.us-east-2.amazonaws.com/dev/hello' from origin 'http://***.ngrok.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
我会感激你的帮助。
如果您需要任何其他信息来理解我的问题,请发表意见。
谢谢。