I want to redirect HTTP traffic to HTTPS. So I want to put my app, which runs on an API Gateway, behind Cloudfront. But I want to use aws_cdk.aws_cloudfront
to launch my Cloudfront instance.
self.distribution = cloudfront.Distribution(
self,
construct_id,
default_behaviour=cloudfront.BehaviorOptions(
origin=cloudfront_origins.RestApiOrigin(api),
...
This would be my ideal implementation. But my api
is of type HttpApi
; I am using aws_apigatewayv2_alpha
.
Is there any way I can use an HttpApi
as the origin of my Cloudfront distribution, using aws_cloudfront
?
You can create Origins from any HTTP endpoint like below, given the domain name, and optionally, other origin properties.