如何在AWS Api网关中从URL中省略阶段名称?

时间:2017-11-02 10:45:14

标签: amazon-web-services aws-api-gateway

如何在Amazon API Gateway的API端点URL中省略阶段名称。

例如,而不是api.domain.com/stagename/resource/我想拥有api.domain.com/resource。

1 个答案:

答案 0 :(得分:2)

您无法从API网址更改阶段,这是API网关的实现,但您可以根据需要将自定义域提供给API网址。

如果您使用自定义域名,则stage是可选的 - http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html#how-to-custom-domains-console

或使用CloudFormation模板 - http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-basepathmapping.html