正在设置缓存,将平铺添加到资源路径



我正在利用AWS的CDK开发我们的API层。到目前为止,一切都正常,现在我正在添加缓存。我在这个阶段启用了CacheCluster,我正试图为我的一些端点启用它。我面临的问题是CDK正在将资源路径从/v1/configuration更改为/~1v1~1configuration。我试过逃离我的/,但这并没有解决我的问题。

CDK C#代码

new Amazon.CDK.AWS.APIGateway.Stage(this, "prod", new Amazon.CDK.AWS.APIGateway.StageProps
{
Deployment = deployment,
StageName = "prod",
Variables = stageVariables,
CacheClusterEnabled = true,
CacheClusterSize = "1.6",
DataTraceEnabled = true,
LoggingLevel = MethodLoggingLevel.INFO,
MetricsEnabled = true,
TracingEnabled = true,
MethodOptions = new Dictionary<string, IMethodDeploymentOptions>
{
{ "/v1/configuration/GET", new MethodDeploymentOptions { CachingEnabled = true }}
}
});

阶段中的结果方法设置:

MethodSettings:
- DataTraceEnabled: true
HttpMethod: "*"
LoggingLevel: INFO
MetricsEnabled: true
ResourcePath: /*
- CachingEnabled: true
HttpMethod: GET
ResourcePath: /~1v1~1configuration

编码为~1的正向斜杠是预期行为。请参阅:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html#cfn-apigateway阶段方法设置资源路径

相关内容

  • 没有找到相关文章

最新更新