如何在AWS CDK中使用CloudFrontWebDistribution构造函数在分布中添加自定义响应头策略.<



我有CloudFrontWebDistribution构造器,我尝试向行为或所有分布资源添加自定义响应头策略。

这是我的承包商:

new CloudFrontWebDistribution(
this,
"CloudConnectUiAppDistribution",
{
originConfigs: [
{
customOriginSource: {
domainName: this._secretStoreApi,
originProtocolPolicy: OriginProtocolPolicy.HTTPS_ONLY,
allowedOriginSSLVersions: [OriginSslPolicy.TLS_V1_2],
},
originPath: "/test",
behaviors: [
{
pathPattern: "/api/secret-stores*",
allowedMethods: CloudFrontAllowedMethods.ALL,
forwardedValues: {
headers: [
"Accept-Encoding",
"Authorization",
"Accept",
"X-Origin-Verify",
],
queryString: true,
cookies: {
forward: "all",
},
},
defaultTtl: Duration.seconds(0),
maxTtl: Duration.hours(1),
},
],
},
],
webACLId: wafPlatformCommonCfAcl,
viewerProtocolPolicy: ViewerProtocolPolicy.HTTPS_ONLY,
viewerCertificate: certificateUtil.getViewerCertificate(
this,
certificateArn,
this._certificateDomain,
this._certificateAlternateDomain,
this._isMasterBranch
),
}
);

我可以在哪里添加响应头策略id?

我使用的是type-script aws-cdk version 1.111.0。只有Distribution构造函数的例子,而CloudFrontWebDistribution

没有。

可能与此重复。我能够测试这个解决方案,并可以确认它是有效的。

相关内容

  • 没有找到相关文章