You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CloudFrontToS3 construct internally creates a new S3Origin for the default behavior from a bucket provided in the props. I am trying to add an additional behavior, but can't find a way to assign it the same origin. Is it even possible with CDK?
constcloudFront=newCloudFrontToS3(this,'CloudFront',{existingBucketObj: destination,insertHttpSecurityHeaders: false,cloudFrontDistributionProps: {comment:`${cdk.Aws.STACK_NAME} Video on Demand Foundation`,defaultBehavior: {allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,compress: false,viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,responseHeadersPolicy: ResponseHeadersPolicy.CORS_ALLOW_ALL_ORIGINS_WITH_PREFLIGHT}}});
I was able to get the targetOriginId from the created distribution, but cloudFront.cloudFrontWebDistribution.addBehavior() only accepts IOrigin and not strings. I wasn't able to find a way to create reference from id either.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
CloudFrontToS3
construct internally creates a newS3Origin
for the default behavior from a bucket provided in the props. I am trying to add an additional behavior, but can't find a way to assign it the same origin. Is it even possible with CDK?This is the code in question (it's from the https://github.com/aws-solutions/video-on-demand-on-aws-foundation):
I was able to get the
targetOriginId
from the created distribution, butcloudFront.cloudFrontWebDistribution.addBehavior()
only acceptsIOrigin
and not strings. I wasn't able to find a way to create reference from id either.Beta Was this translation helpful? Give feedback.
All reactions