HttpVersion Enum
The HTTP version(s) to enable on the distribution.
Note: Setting HTTP3 enables HTTP 3 only (not HTTP 2). To support both HTTP 2 and HTTP 3, use HTTP2_AND_3.
| Source | aws-cloudfront/lib/distribution.ts |
|---|---|
| Type last changed |
Example
ts
// Configure a distribution to use HTTP/2 and HTTP/3
new cloudfront.Distribution(this, 'myDist', {
defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') },
httpVersion: cloudfront.HttpVersion.HTTP2_AND_3,
});
python
# Configure a distribution to use HTTP/2 and HTTP/3
cloudfront.Distribution(self, "myDist",
default_behavior=cloudfront.BehaviorOptions(origin=origins.HttpOrigin("www.example.com")),
http_version=cloudfront.HttpVersion.HTTP2_AND_3
)
java
// Configure a distribution to use HTTP/2 and HTTP/3
// Configure a distribution to use HTTP/2 and HTTP/3
Distribution.Builder.create(this, "myDist")
.defaultBehavior(BehaviorOptions.builder().origin(new HttpOrigin("www.example.com")).build())
.httpVersion(HttpVersion.HTTP2_AND_3)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Configure a distribution to use HTTP/2 and HTTP/3
// Configure a distribution to use HTTP/2 and HTTP/3
new Distribution(this, "myDist", new DistributionProps {
DefaultBehavior = new BehaviorOptions { Origin = new HttpOrigin("www.example.com") },
HttpVersion = HttpVersion.HTTP2_AND_3
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Configure a distribution to use HTTP/2 and HTTP/3
// Configure a distribution to use HTTP/2 and HTTP/3
cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewHttpOrigin(jsii.String("www.example.com")),
},
HttpVersion: cloudfront.HttpVersion_HTTP2_AND_3,
})
Members
| Member | Description |
|---|---|
HTTP1_1 | HTTP 1.1 only. |
HTTP2 | HTTP 2 only. |
HTTP2_AND_3 | HTTP 2 and HTTP 3. |
HTTP3 | HTTP 3 only (does not include HTTP 2). |
Referenced by
CloudFrontWebDistributionProps.httpVersionhttp_versionhttpVersionHttpVersionHttpVersionDistributionProps.httpVersionhttp_versionhttpVersionHttpVersionHttpVersion