Amazon web services 如何在aws api网关中自定义错误路径请求的错误消息?
我使用api网关和自定义授权程序。 在参考资料中定义了路径后,一切正常。 当url/路径中出现输入错误时,我会在下面看到这个错误。 我可以自定义此错误消息吗?我想告诉打电话的人,他们请求的路径是错误的Amazon web services 如何在aws api网关中自定义错误路径请求的错误消息?,amazon-web-services,aws-api-gateway,Amazon Web Services,Aws Api Gateway,我使用api网关和自定义授权程序。 在参考资料中定义了路径后,一切正常。 当url/路径中出现输入错误时,我会在下面看到这个错误。 我可以自定义此错误消息吗?我想告诉打电话的人,他们请求的路径是错误的 { "message": "Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requi
{
"message": "Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requires 'SignedHeaders' parameter. Authorization header requires existence of either a 'X-Amz-Date' or a 'Date' header. Authorization="
}
是的,你应该能做到这一点。文档的整个部分都有专门针对这个问题的标题。是的,您应该能够做到这一点。文档的整个部分都有专门针对这个问题的标题。我应该为缺少的\u身份验证\u令牌定义responseTemplates 缺少身份验证令牌错误的网关响应,包括客户端尝试调用不受支持的API方法或资源时的情况。如果未指定响应类型,则此响应默认为默认的_4XX类型
我应该为丢失的\u身份验证\u令牌定义响应模板 缺少身份验证令牌错误的网关响应,包括客户端尝试调用不受支持的API方法或资源时的情况。如果未指定响应类型,则此响应默认为默认的_4XX类型
谢谢。我应该为缺少的\u身份验证\u令牌定义responseTemplate。谢谢我应该为缺少的\u身份验证\u令牌定义responseTemplate。
"x-amazon-apigateway-gateway-responses": {
"MISSING_AUTHENTICATION_TOKEN": {
"responseParameters": {
"gatewayresponse.header.Access-Control-Allow-Origin": "'*'"
},
"responseTemplates": {
"application/json": "{\"message\":$context.error.messageString,\"hint\":\"The HTTP method or resources may not be supported. "}"
}
}
}