我有一个 React 应用程序并尝试从 aws 访问无服务器。但我有以下错误
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.test.com' is therefore not allowed access. The response had HTTP status code 502.
端点网址是https://key.execute-api.ap-southeast-2.amazonaws.com/dev/samplefunction
serverless.yml 上的设置是
login:
handler: login.login
events:
- http:
path: login
method: post
cors:
origin: 'https://admin.differentdomain.com'
headers:
- MY_CUSTOM_HEADER
- Content-Type
- X-Amz-Date
- Authorization
- X-Api-Key
- X-Amz-Security-Token
我还需要在其他地方进行 CORS 配置吗?