Skip to content

Commit

Permalink
Merge branch 'main' into corymhall/integ-runner/v2-public
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Aug 16, 2022
2 parents f84409d + ae5aceb commit 54e6585
Show file tree
Hide file tree
Showing 47 changed files with 1,128 additions and 47 deletions.
14 changes: 14 additions & 0 deletions packages/@aws-cdk/aws-cloudfront/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,20 @@ new cloudfront.Distribution(this, 'myDist', {
});
```

### HTTP Versions

You can configure CloudFront to use a particular version of the HTTP protocol. By default,
newly created distributions use HTTP/2 but can be configured to use both HTTP/2 and HTTP/3 or
just HTTP/3. For all supported HTTP versions, see the `HttpVerson` enum.

```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,
});
```

### Importing Distributions

Existing distributions can be imported as well; note that like most imported constructs, an imported distribution cannot be modified.
Expand Down
6 changes: 5 additions & 1 deletion packages/@aws-cdk/aws-cloudfront/lib/distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,11 @@ export enum HttpVersion {
/** HTTP 1.1 */
HTTP1_1 = 'http1.1',
/** HTTP 2 */
HTTP2 = 'http2'
HTTP2 = 'http2',
/** HTTP 2 and HTTP 3 */
HTTP2_AND_3 = 'http2and3',
/** HTTP 3 */
HTTP3 = 'http3'
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-cloudfront/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"devDependencies": {
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/integ-tests": "0.0.0",
"@aws-cdk/integ-runner": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"20.0.0"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"Resources": {
"Http118E669F5D": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"DefaultCacheBehavior": {
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"TargetOriginId": "integdistributionhttpversionHttp11Origin117833241",
"ViewerProtocolPolicy": "allow-all"
},
"Enabled": true,
"HttpVersion": "http1.1",
"IPV6Enabled": true,
"Origins": [
{
"CustomOriginConfig": {
"OriginProtocolPolicy": "https-only"
},
"DomainName": "www.example.com",
"Id": "integdistributionhttpversionHttp11Origin117833241"
}
]
}
}
},
"Http25ED2A59B": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"DefaultCacheBehavior": {
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"TargetOriginId": "integdistributionhttpversionHttp2Origin15C0A1B66",
"ViewerProtocolPolicy": "allow-all"
},
"Enabled": true,
"HttpVersion": "http2",
"IPV6Enabled": true,
"Origins": [
{
"CustomOriginConfig": {
"OriginProtocolPolicy": "https-only"
},
"DomainName": "www.example.com",
"Id": "integdistributionhttpversionHttp2Origin15C0A1B66"
}
]
}
}
},
"Http2and3D987DA75": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"DefaultCacheBehavior": {
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"TargetOriginId": "integdistributionhttpversionHttp2and3Origin1487BBB15",
"ViewerProtocolPolicy": "allow-all"
},
"Enabled": true,
"HttpVersion": "http2and3",
"IPV6Enabled": true,
"Origins": [
{
"CustomOriginConfig": {
"OriginProtocolPolicy": "https-only"
},
"DomainName": "www.example.com",
"Id": "integdistributionhttpversionHttp2and3Origin1487BBB15"
}
]
}
}
},
"Http31D566096": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"DefaultCacheBehavior": {
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"TargetOriginId": "integdistributionhttpversionHttp3Origin10970C9C4",
"ViewerProtocolPolicy": "allow-all"
},
"Enabled": true,
"HttpVersion": "http3",
"IPV6Enabled": true,
"Origins": [
{
"CustomOriginConfig": {
"OriginProtocolPolicy": "https-only"
},
"DomainName": "www.example.com",
"Id": "integdistributionhttpversionHttp3Origin10970C9C4"
}
]
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "20.0.0",
"testCases": {
"DistributionHttpVersion/DefaultTest": {
"stacks": [
"integ-distribution-http-version"
],
"assertionStack": "DistributionHttpVersionDefaultTestDeployAssert506965CB"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"version": "20.0.0",
"artifacts": {
"Tree": {
"type": "cdk:tree",
"properties": {
"file": "tree.json"
}
},
"integ-distribution-http-version": {
"type": "aws:cloudformation:stack",
"environment": "aws://unknown-account/unknown-region",
"properties": {
"templateFile": "integ-distribution-http-version.template.json",
"validateOnSynth": false
},
"metadata": {
"/integ-distribution-http-version/Http11/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "Http118E669F5D"
}
],
"/integ-distribution-http-version/Http2/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "Http25ED2A59B"
}
],
"/integ-distribution-http-version/Http2and3/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "Http2and3D987DA75"
}
],
"/integ-distribution-http-version/Http3/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "Http31D566096"
}
]
},
"displayName": "integ-distribution-http-version"
},
"DistributionHttpVersionDefaultTestDeployAssert506965CB": {
"type": "aws:cloudformation:stack",
"environment": "aws://unknown-account/unknown-region",
"properties": {
"templateFile": "DistributionHttpVersionDefaultTestDeployAssert506965CB.template.json",
"validateOnSynth": false
},
"displayName": "DistributionHttpVersion/DefaultTest/DeployAssert"
}
}
}
Loading

0 comments on commit 54e6585

Please sign in to comment.