-
I have a CloudFrontWebDistribution and I want a way to pass a user pool ID, identity pool ID, and cognito client ID in as a header behavior. I can't find a way to do that with a CloudFrontWebDistribution - is it possible?
I know I could create a headers policy pretty easily:
but I can't figure out how to attach that to the CloudFrontWebDistribution. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
OK. After doing some additional research on this I think I figured it out. The idea is dont' use CloudFrontWebDistribution, just use a Distribution. If you do that, you have a lot more options you can set, including one named responseHeadersPolicy, which does exactly what I wanted. I answered my own question, but I'm going to leave this here in case anybody else has trouble figuring it out. It's probably worth noting this that I found on StackOverflow:
const headersPolicy = new ResponseHeadersPolicy(
this,
"xxxx-cf-header-policy",
{
customHeadersBehavior: {
customHeaders: [
{ header: 'X-cognito-user-poole', value: 'some-value', override: true },
],
},
}
)
const rrCfDist: IDistribution = new Distribution(this,
"xxxx-cf-dist",
{
defaultBehavior: {
origin: new S3Origin( buckets.publicBucket, {
originAccessIdentity: rrOia
}),
viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
responseHeadersPolicy: headersPolicy
},
certificate: this.combinedCertificate
}
); |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
OK. After doing some additional research on this I think I figured it out. The idea is dont' use CloudFrontWebDistribution, just use a Distribution. If you do that, you have a lot more options you can set, including one named responseHeadersPolicy, which does exactly what I wanted.
I answered my own question, but I'm going to leave this here in case anybody else has trouble figuring it out.
It's probably worth noting this that I found on StackOverflow: