有多个端点时,无服务器CORS停止工作

时间:2019-02-02 21:14:32

标签: cors serverless-framework serverless aws-serverless

我有以下配置

in

问题是,一旦我添加了端点functions: auth: handler: functions/auth.handler cors: true one: handler: functions/one.handler events: - http: path: one method: post authorizer: auth cors: true two: handler: functions/two.handler events: - http: path: two method: post authorizer: auth cors: true resources: Resources: GatewayResponse: Type: 'AWS::ApiGateway::GatewayResponse' Properties: ResponseParameters: gatewayresponse.header.Access-Control-Allow-Origin: "'*'" gatewayresponse.header.Access-Control-Allow-Headers: "'*'" ResponseType: EXPIRED_TOKEN RestApiId: Ref: 'ApiGatewayRestApi' StatusCode: '401' AuthFailureGatewayResponse: Type: 'AWS::ApiGateway::GatewayResponse' Properties: ResponseParameters: gatewayresponse.header.Access-Control-Allow-Origin: "'*'" gatewayresponse.header.Access-Control-Allow-Headers: "'*'" ResponseType: UNAUTHORIZED RestApiId: Ref: 'ApiGatewayRestApi' StatusCode: '401' ,cors便停止工作,我需要将其删除并只留下一个端点,我尝试使用它,更改了方法,但问题仍然存在

所有lambda返回如下:

two

因此设置了标头。再次,这一问题出现时的第二端点被添加,如果我只留下一个它独立工作。

有什么想法吗?

0 个答案:

没有答案