From 262b5b02332bb07a3b0a62197c09e2afd3881b75 Mon Sep 17 00:00:00 2001 From: Joseph Palomino Date: Fri, 13 May 2022 11:43:02 -0500 Subject: [PATCH 01/14] updates to work with our deploy process --- .../aws-cloudfront/src/getOriginConfig.ts | 4 +- .../nextjs-cdk-construct/package.json | 2 + .../nextjs-component/src/component.ts | 65 +- yarn.lock | 651 ++++++++++++++++++ 4 files changed, 696 insertions(+), 26 deletions(-) diff --git a/packages/serverless-components/aws-cloudfront/src/getOriginConfig.ts b/packages/serverless-components/aws-cloudfront/src/getOriginConfig.ts index b93427b398..3d399fc2bd 100644 --- a/packages/serverless-components/aws-cloudfront/src/getOriginConfig.ts +++ b/packages/serverless-components/aws-cloudfront/src/getOriginConfig.ts @@ -78,8 +78,8 @@ export const getOriginConfig = ( Quantity: 1, Items: ["TLSv1.2"] }, - OriginReadTimeout: 30, - OriginKeepaliveTimeout: 5 + OriginReadTimeout: 60, + OriginKeepaliveTimeout: 60 }; } diff --git a/packages/serverless-components/nextjs-cdk-construct/package.json b/packages/serverless-components/nextjs-cdk-construct/package.json index ba463b8749..39ea4ddd6a 100644 --- a/packages/serverless-components/nextjs-cdk-construct/package.json +++ b/packages/serverless-components/nextjs-cdk-construct/package.json @@ -29,6 +29,8 @@ }, "license": "MIT", "dependencies": { + "@aws-cdk/aws-ec2": "^1.156.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^1.156.0", "@sls-next/core": "link:../../libs/core", "@sls-next/lambda-at-edge": "link:../../libs/lambda-at-edge", "fast-glob": "3.2.11", diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index 4b4afe24ac..bd75712b00 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -286,6 +286,8 @@ class NextjsComponent extends Component { async deploy( inputs: ServerlessComponentInputs = {} ): Promise { + // @ts-ignore + console.log(inputs.loadBalancer); // Skip deployment if user explicitly set deploy input to false. // Useful when they just want the build outputs to deploy themselves. if (inputs.deploy === "false" || inputs.deploy === false) { @@ -409,6 +411,10 @@ class NextjsComponent extends Component { } const cloudFrontOrigins = [ + { + // @ts-ignore + url: inputs.loadBalancer + }, { url: bucketUrl, private: true, @@ -417,7 +423,10 @@ class NextjsComponent extends Component { ...inputOrigins ]; - cloudFrontOrigins[0].pathPatterns[ + console.log(cloudFrontOrigins[0]); + + + cloudFrontOrigins[1].pathPatterns[ this.pathPattern("_next/static/*", routesManifest) ] = { minTTL: 0, @@ -430,7 +439,7 @@ class NextjsComponent extends Component { } }; - cloudFrontOrigins[0].pathPatterns[ + cloudFrontOrigins[1].pathPatterns[ this.pathPattern("static/*", routesManifest) ] = { minTTL: 0, @@ -663,7 +672,7 @@ class NextjsComponent extends Component { const apiEdgeLambdaPublishOutputs = await apiEdgeLambda.publishVersion(); - cloudFrontOrigins[0].pathPatterns[ + cloudFrontOrigins[1].pathPatterns[ this.pathPattern("api/*", routesManifest) ] = { minTTL: 0, @@ -734,7 +743,7 @@ class NextjsComponent extends Component { const imageEdgeLambdaPublishOutputs = await imageEdgeLambda.publishVersion(); - cloudFrontOrigins[0].pathPatterns[ + cloudFrontOrigins[1].pathPatterns[ this.pathPattern("_next/image*", routesManifest) ] = { minTTL: 0, @@ -799,7 +808,7 @@ class NextjsComponent extends Component { const defaultEdgeLambdaPublishOutputs = await defaultEdgeLambda.publishVersion(); - cloudFrontOrigins[0].pathPatterns[ + cloudFrontOrigins[1].pathPatterns[ this.pathPattern("_next/data/*", routesManifest) ] = { minTTL: 0, @@ -821,13 +830,33 @@ class NextjsComponent extends Component { } }; + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/business*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; + // If we are using consolidated API pages (within default lambda), we need to ensure api/* behavior is set correctly. // Note that if there are no consolidated API pages then existing api/* is not deleted. // We do so for a couple reasons: // 1. API pages don't need origin response handler as it's not retrieving from S3 origin // 2. Override existing api/* behavior to ensure old separate API lambda isn't there if (hasConsolidatedApiPages) { - cloudFrontOrigins[0].pathPatterns[ + cloudFrontOrigins[1].pathPatterns[ this.pathPattern("api/*", routesManifest) ] = { minTTL: 0, @@ -886,15 +915,15 @@ class NextjsComponent extends Component { ] = `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`; } - cloudFrontOrigins[0].pathPatterns[path] = { + cloudFrontOrigins[1].pathPatterns[path] = { // spread the existing value if there is one - ...cloudFrontOrigins[0].pathPatterns[path], + ...cloudFrontOrigins[1].pathPatterns[path], // spread custom config ...config, "lambda@edge": { // spread the provided value - ...(cloudFrontOrigins[0].pathPatterns[path] && - cloudFrontOrigins[0].pathPatterns[path]["lambda@edge"]), + ...(cloudFrontOrigins[1].pathPatterns[path] && + cloudFrontOrigins[1].pathPatterns[path]["lambda@edge"]), // then overrides ...edgeConfig } @@ -913,15 +942,13 @@ class NextjsComponent extends Component { const cloudFrontOutputs = await cloudFront({ bucketRegion: bucketRegion, distributionId: cloudFrontDistributionId, - defaults: { + defaults: { minTTL: 0, defaultTTL: 0, maxTTL: 31536000, ...cloudFrontDefaults, forward: { - headers: routesManifest.i18n - ? ["Accept-Language", "Authorization", "Host"] - : ["Authorization", "Host"], + headers: "all", cookies: "all", queryString: true, ...cloudFrontDefaults.forward @@ -936,16 +963,6 @@ class NextjsComponent extends Component { "PUT", "PATCH" ], - "lambda@edge": buildOptions.disableOriginResponseHandler - ? { - ...defaultLambdaAtEdgeConfig, - "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` - } - : { - ...defaultLambdaAtEdgeConfig, - "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, - "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` - }, compress: true }, origins: cloudFrontOrigins, diff --git a/yarn.lock b/yarn.lock index d572357cbc..b9ddaedf55 100644 --- a/yarn.lock +++ b/yarn.lock @@ -27,6 +27,553 @@ __metadata: languageName: node linkType: hard +"@aws-cdk/assets@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/assets@npm:1.156.0" + dependencies: + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + checksum: 1be868efa12d6fa9d001ac2187eba77143dddd95124120854afdae088bfdc022297a0e641afb6669ce92a5e1bc0a6fdeaf329e284f03a6d1bdecec2dac7e2784 + languageName: node + linkType: hard + +"@aws-cdk/aws-acmpca@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-acmpca@npm:1.156.0" + dependencies: + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: ac862f6cb60b81d8e2df7f5e686a19813e41cfbb79ebf283246e9ca9e69f797ad57b1ff4f6332d7693f2262229c8e7fdb6769d287629deb118b036945d80fbd3 + languageName: node + linkType: hard + +"@aws-cdk/aws-applicationautoscaling@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-applicationautoscaling@npm:1.156.0" + dependencies: + "@aws-cdk/aws-autoscaling-common": 1.156.0 + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-autoscaling-common": 1.156.0 + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: f26886fcb1b1b0e66c12dee7b7fe2f90fc7b9428ac189bffd5745318c56f1a89046cd4ff51f4e318f835b7076ead3db7e374abbb8cfa4bdac31d78430225b601 + languageName: node + linkType: hard + +"@aws-cdk/aws-autoscaling-common@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-autoscaling-common@npm:1.156.0" + dependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: 777e4d86300c4d9dbc6f80d8c17693a6c4fc1c7abe64a338e830adf1886617af7e838ce187499410e5999690d665c4f9afe6154ccad366cdcc8c9996a687025d + languageName: node + linkType: hard + +"@aws-cdk/aws-certificatemanager@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-certificatemanager@npm:1.156.0" + dependencies: + "@aws-cdk/aws-acmpca": 1.156.0 + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-lambda": 1.156.0 + "@aws-cdk/aws-route53": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-acmpca": 1.156.0 + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-lambda": 1.156.0 + "@aws-cdk/aws-route53": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: 8c028e09e9015a5cd30e54720c5d32eb194dc9f58774dd090df58ae14da78c1330471195a4b9e4011843132372b16cb9813658ec1fdf418e19a118332dbae8be + languageName: node + linkType: hard + +"@aws-cdk/aws-cloudformation@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-cloudformation@npm:1.156.0" + dependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-lambda": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/aws-sns": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-lambda": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/aws-sns": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + checksum: 7ddb736b3794b9a68f386f95afee047f0649834936a312a1db2930e482ca181698f874fc1f32c93b078edbb4fe2cbb231df166b0c0425f668a4ec9087d19f497 + languageName: node + linkType: hard + +"@aws-cdk/aws-cloudwatch@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-cloudwatch@npm:1.156.0" + dependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: 7dd30d77145ecb4df06755afb571baf6e586162581f072d9c941af15234c18a29f2e6c7660ff6005dbbba801b85d5500bf6a236f3a6286419232476edb51932c + languageName: node + linkType: hard + +"@aws-cdk/aws-codeguruprofiler@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-codeguruprofiler@npm:1.156.0" + dependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: 9139076da091448d04b8a36988676b0e2b8c6993d481e242453cb754ccc6e0ecdcd3930fa95625cef28b039820572331700ce10278a9ad0611ae537b6290aa7b + languageName: node + linkType: hard + +"@aws-cdk/aws-codestarnotifications@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-codestarnotifications@npm:1.156.0" + dependencies: + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: ca46f11d0662dd029de3077e4852a40d1c050c11eadbd0f8be7fdc3ddc56ef12c2a185634706815ba74d6cdceaf076f7734b9a4abcdf42d3d1465a0bf29de92b + languageName: node + linkType: hard + +"@aws-cdk/aws-ec2@npm:1.156.0, @aws-cdk/aws-ec2@npm:^1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-ec2@npm:1.156.0" + dependencies: + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/aws-logs": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/aws-s3-assets": 1.156.0 + "@aws-cdk/aws-ssm": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + "@aws-cdk/region-info": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/aws-logs": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/aws-s3-assets": 1.156.0 + "@aws-cdk/aws-ssm": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + "@aws-cdk/region-info": 1.156.0 + constructs: ^3.3.69 + checksum: 35f520381980b0c628e59ea70fe7705c62b9247cb1d47a78518f91caac82c1e4ef7e98bfeb330a7f1d2b2df58891f4a72c271cb804080cd948b0ff633a0fc97d + languageName: node + linkType: hard + +"@aws-cdk/aws-ecr-assets@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-ecr-assets@npm:1.156.0" + dependencies: + "@aws-cdk/assets": 1.156.0 + "@aws-cdk/aws-ecr": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/assets": 1.156.0 + "@aws-cdk/aws-ecr": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + checksum: 17106b82a004bd17ffa9df31e8c78e3e3e984c44e47b1d5ffbeebef3159f837fbf40ba2278aee4dafdb4fb80a7fdd064721ed2b3076ebe774c592e671dd88256 + languageName: node + linkType: hard + +"@aws-cdk/aws-ecr@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-ecr@npm:1.156.0" + dependencies: + "@aws-cdk/aws-events": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-events": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: 892210ee9718fbfac5a148baf542aacbe6797caee43ad591c41fa1c02775773140bef906d83caff2329ab2c092e53f8f9a5cf5a82d1e7d68be6a09d4fd4a0a87 + languageName: node + linkType: hard + +"@aws-cdk/aws-efs@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-efs@npm:1.156.0" + dependencies: + "@aws-cdk/aws-ec2": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-ec2": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + checksum: 31c1837f9f8e5ca492be3c5dd6f4657400e3e03343cf616b382a773c15792a03b64e04c9c097bc5bb765957e23c495b1020651dc3a6c25023e98be482a844c46 + languageName: node + linkType: hard + +"@aws-cdk/aws-elasticloadbalancingv2@npm:^1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-elasticloadbalancingv2@npm:1.156.0" + dependencies: + "@aws-cdk/aws-certificatemanager": 1.156.0 + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-ec2": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-lambda": 1.156.0 + "@aws-cdk/aws-route53": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + "@aws-cdk/region-info": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-certificatemanager": 1.156.0 + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-ec2": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-lambda": 1.156.0 + "@aws-cdk/aws-route53": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + "@aws-cdk/region-info": 1.156.0 + constructs: ^3.3.69 + checksum: af29756424aa52a7ca7aa82989f81c13ee950b76f8405a134bdf2b1412f628c5b9af926e88f7612e3ce076747b2ac20b7baf725c64fe65a2354d5cf66958f210 + languageName: node + linkType: hard + +"@aws-cdk/aws-events@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-events@npm:1.156.0" + dependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: 9dbc239476bbfc7ccd8f710010d21e42685c0acfc1d0f4a735341bb6e4f204c07afc3c353732cff3b00ac4f9da6b49fb35896f358c588de38e61667c0943e39f + languageName: node + linkType: hard + +"@aws-cdk/aws-iam@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-iam@npm:1.156.0" + dependencies: + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + "@aws-cdk/region-info": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/core": 1.156.0 + "@aws-cdk/region-info": 1.156.0 + constructs: ^3.3.69 + checksum: 79d6df9f5655687a01209476bcf3f895223691e26603b50f70c55b1df9bd6a2c10864918305970b40c206a551a48f64fe5f4fbd310a5f58e0521538c40a8d2f0 + languageName: node + linkType: hard + +"@aws-cdk/aws-kms@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-kms@npm:1.156.0" + dependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + checksum: 08976b8f85472db49bcb5a7205f00d693853e9ec23aca622b5d45b5aa3a847f795fe73bfed9719b0000f9a9720fb455c3e849d45f65a701228360914a90809e9 + languageName: node + linkType: hard + +"@aws-cdk/aws-lambda@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-lambda@npm:1.156.0" + dependencies: + "@aws-cdk/aws-applicationautoscaling": 1.156.0 + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-codeguruprofiler": 1.156.0 + "@aws-cdk/aws-ec2": 1.156.0 + "@aws-cdk/aws-ecr": 1.156.0 + "@aws-cdk/aws-ecr-assets": 1.156.0 + "@aws-cdk/aws-efs": 1.156.0 + "@aws-cdk/aws-events": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/aws-logs": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/aws-s3-assets": 1.156.0 + "@aws-cdk/aws-signer": 1.156.0 + "@aws-cdk/aws-sns": 1.156.0 + "@aws-cdk/aws-sqs": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + "@aws-cdk/region-info": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-applicationautoscaling": 1.156.0 + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-codeguruprofiler": 1.156.0 + "@aws-cdk/aws-ec2": 1.156.0 + "@aws-cdk/aws-ecr": 1.156.0 + "@aws-cdk/aws-ecr-assets": 1.156.0 + "@aws-cdk/aws-efs": 1.156.0 + "@aws-cdk/aws-events": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/aws-logs": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/aws-s3-assets": 1.156.0 + "@aws-cdk/aws-signer": 1.156.0 + "@aws-cdk/aws-sns": 1.156.0 + "@aws-cdk/aws-sqs": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + "@aws-cdk/region-info": 1.156.0 + constructs: ^3.3.69 + checksum: ca3f2d6af59fc2d3a99e496a396ba109ca446feaaaa0a76d0a7d0af35bc179749db587f0e7d4eda3bf481e4e2124cd3138a3139f643900d62ee01788bb7292a9 + languageName: node + linkType: hard + +"@aws-cdk/aws-logs@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-logs@npm:1.156.0" + dependencies: + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/aws-s3-assets": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/aws-s3-assets": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + checksum: 3934181c0c95850de1d2e1e6a72e1d9a66a49022464317b386762bcdf02abeea428db38c63b633b47a2ed84d0f3e704b77db1db0ba4b9d7d0f371d66f8b7f405 + languageName: node + linkType: hard + +"@aws-cdk/aws-route53@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-route53@npm:1.156.0" + dependencies: + "@aws-cdk/aws-ec2": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-logs": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/custom-resources": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-ec2": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-logs": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/custom-resources": 1.156.0 + constructs: ^3.3.69 + checksum: c29f2a34d44bf423bb867d9c22a28115604805e33fc53dfa39d886ea8ac25e9a2964f9eda163ffc4dac4048ef9bc43f3229aa384a15d9718f56ade391567d48f + languageName: node + linkType: hard + +"@aws-cdk/aws-s3-assets@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-s3-assets@npm:1.156.0" + dependencies: + "@aws-cdk/assets": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/assets": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/aws-s3": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + checksum: 984dc5dba88566390dd33b9c1dd5123698585ee284f0d7fdb581524ffa8e8c02cf36b9b40093105350239d11893a96e040bf36971d76602a34cd8bc2a9636982 + languageName: node + linkType: hard + +"@aws-cdk/aws-s3@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-s3@npm:1.156.0" + dependencies: + "@aws-cdk/aws-events": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-events": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/core": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + constructs: ^3.3.69 + checksum: 479c0750e62a9ad43725d2d1e728c69468039c1ff75ea43619051b0bcf19f51c018bfb0c4f1d2dcbdc5ed24c5879dd722b84f394135c262342f378f27a55ad39 + languageName: node + linkType: hard + +"@aws-cdk/aws-signer@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-signer@npm:1.156.0" + dependencies: + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: 80f942b9f2f2f455e03793e1d8cfcf0293b9fa6689f7c85e97393cb7c9b199f4b61ea3bf7c479ae06352fe18f5be62f9801a45f907dfdc8138e71faf7c4e7d41 + languageName: node + linkType: hard + +"@aws-cdk/aws-sns@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-sns@npm:1.156.0" + dependencies: + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-codestarnotifications": 1.156.0 + "@aws-cdk/aws-events": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/aws-sqs": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-codestarnotifications": 1.156.0 + "@aws-cdk/aws-events": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/aws-sqs": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: 79740b7ed18fc7fe6abd0b98cab44594c4554646f491e905d64cd4b9ddcd99c240c17a475061337b23d4d3fbe7ebce2bf7d29b6bf0c5af0ba95fac272eede944 + languageName: node + linkType: hard + +"@aws-cdk/aws-sqs@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-sqs@npm:1.156.0" + dependencies: + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-cloudwatch": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: 7c8852e24247954c5316e8b159451f2676791e1e3e94096b7b96da31535815fed943f05810c6495258ad3c399c5112756da752fb9f7d68ce9ef87d8a4ebb187d + languageName: node + linkType: hard + +"@aws-cdk/aws-ssm@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/aws-ssm@npm:1.156.0" + dependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-kms": 1.156.0 + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: 7b9c03bf5432fc2d5c22ff1124a9c36a23d6bf7373ef7203fe60c0ed2054eefbd48f60242dcf9c0bde92e95205380cf748c6d0977a5fc54dd8f73624e2d9824f + languageName: node + linkType: hard + "@aws-cdk/cfnspec@npm:2.13.0": version: 2.13.0 resolution: "@aws-cdk/cfnspec@npm:2.13.0" @@ -37,6 +584,16 @@ __metadata: languageName: node linkType: hard +"@aws-cdk/cloud-assembly-schema@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/cloud-assembly-schema@npm:1.156.0" + dependencies: + jsonschema: ^1.4.0 + semver: ^7.3.7 + checksum: 5b58b02857fd893fa94d2e30fd19558a00532d353e8dcd38cd49c9c0cce4f519d5ee8f308a047f1224359e9537ea6f70a4d37626b63f2d73854d0e54f2cc9a41 + languageName: node + linkType: hard + "@aws-cdk/cloud-assembly-schema@npm:2.13.0": version: 2.13.0 resolution: "@aws-cdk/cloud-assembly-schema@npm:2.13.0" @@ -62,6 +619,64 @@ __metadata: languageName: node linkType: hard +"@aws-cdk/core@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/core@npm:1.156.0" + dependencies: + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + "@aws-cdk/region-info": 1.156.0 + "@balena/dockerignore": ^1.0.2 + constructs: ^3.3.69 + fs-extra: ^9.1.0 + ignore: ^5.2.0 + minimatch: ^3.1.2 + peerDependencies: + "@aws-cdk/cloud-assembly-schema": 1.156.0 + "@aws-cdk/cx-api": 1.156.0 + "@aws-cdk/region-info": 1.156.0 + constructs: ^3.3.69 + checksum: 5808b0949ad406176ddcfc633b9e4bd1510732ce9c2b6c741f0b502a01c2aa4067bf7ac40a580027ddf8dbe9be7ba9178b50991fd71a841a15009b1f9d7422c8 + languageName: node + linkType: hard + +"@aws-cdk/custom-resources@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/custom-resources@npm:1.156.0" + dependencies: + "@aws-cdk/aws-cloudformation": 1.156.0 + "@aws-cdk/aws-ec2": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-lambda": 1.156.0 + "@aws-cdk/aws-logs": 1.156.0 + "@aws-cdk/aws-sns": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + peerDependencies: + "@aws-cdk/aws-cloudformation": 1.156.0 + "@aws-cdk/aws-ec2": 1.156.0 + "@aws-cdk/aws-iam": 1.156.0 + "@aws-cdk/aws-lambda": 1.156.0 + "@aws-cdk/aws-logs": 1.156.0 + "@aws-cdk/aws-sns": 1.156.0 + "@aws-cdk/core": 1.156.0 + constructs: ^3.3.69 + checksum: 6bae8feedeb7df6301f17f677a7ae38067b9d3663ad85133e7cfc4f39f28988c29c96b01b54a38a82d4676f181900bf2b55b9c5271ddd0a104b1084644edbadf + languageName: node + linkType: hard + +"@aws-cdk/cx-api@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/cx-api@npm:1.156.0" + dependencies: + "@aws-cdk/cloud-assembly-schema": 1.156.0 + semver: ^7.3.7 + peerDependencies: + "@aws-cdk/cloud-assembly-schema": 1.156.0 + checksum: 6d2b60bc8263de606c2ce658103388ece5c2ac06d8ba87ede8cb3e221493b0069101e0bd66d41c8d8c472d640995a54f14285575d4c3d3f24f56faa5aea7f822 + languageName: node + linkType: hard + "@aws-cdk/cx-api@npm:2.13.0": version: 2.13.0 resolution: "@aws-cdk/cx-api@npm:2.13.0" @@ -74,6 +689,13 @@ __metadata: languageName: node linkType: hard +"@aws-cdk/region-info@npm:1.156.0": + version: 1.156.0 + resolution: "@aws-cdk/region-info@npm:1.156.0" + checksum: a2490a7cf7d7b43444a2e5284833afbe6753d08e4a8758a31cafddf52247dee4b5522db14779d83e077f737b853d803f815132845f630f7d4ab32d7394a3da50 + languageName: node + linkType: hard + "@aws-cdk/region-info@npm:2.13.0": version: 2.13.0 resolution: "@aws-cdk/region-info@npm:2.13.0" @@ -5963,6 +6585,8 @@ __metadata: resolution: "@sls-next/cdk-construct@workspace:packages/serverless-components/nextjs-cdk-construct" dependencies: "@aws-cdk/assert": ^2.13.0 + "@aws-cdk/aws-ec2": ^1.156.0 + "@aws-cdk/aws-elasticloadbalancingv2": ^1.156.0 "@sls-next/core": "link:../../libs/core" "@sls-next/lambda-at-edge": "link:../../libs/lambda-at-edge" "@types/fs-extra": 9.0.13 @@ -9283,6 +9907,13 @@ __metadata: languageName: node linkType: hard +"constructs@npm:^3.3.69": + version: 3.4.7 + resolution: "constructs@npm:3.4.7" + checksum: 3b6b77d729b0beaeb400aaba2b2335609e8541b59b96b1679bdc0a6ed3973fe8be66526213e3e2402a76552593ce4aca8978c08b236dac50c1128939fb7dee0c + languageName: node + linkType: hard + "conventional-changelog-angular@npm:^5.0.12": version: 5.0.13 resolution: "conventional-changelog-angular@npm:5.0.13" @@ -15527,6 +16158,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:^3.1.2": + version: 3.1.2 + resolution: "minimatch@npm:3.1.2" + dependencies: + brace-expansion: ^1.1.7 + checksum: c154e566406683e7bcb746e000b84d74465b3a832c45d59912b9b55cd50dee66e5c4b1e5566dba26154040e51672f9aa450a9aef0c97cfc7336b78b7afb9540a + languageName: node + linkType: hard + "minimist-options@npm:4.1.0": version: 4.1.0 resolution: "minimist-options@npm:4.1.0" @@ -18344,6 +18984,17 @@ __metadata: languageName: node linkType: hard +"semver@npm:^7.3.7": + version: 7.3.7 + resolution: "semver@npm:7.3.7" + dependencies: + lru-cache: ^6.0.0 + bin: + semver: bin/semver.js + checksum: 2fa3e877568cd6ce769c75c211beaed1f9fce80b28338cadd9d0b6c40f2e2862bafd62c19a6cff42f3d54292b7c623277bcab8816a2b5521cf15210d43e75232 + languageName: node + linkType: hard + "send@npm:0.17.2": version: 0.17.2 resolution: "send@npm:0.17.2" From 54ef2dfe4c0f546c623bbe2b0069f5e5b15e3a11 Mon Sep 17 00:00:00 2001 From: aapcit <101750781+aapcit@users.noreply.github.com> Date: Wed, 25 May 2022 09:45:02 -0600 Subject: [PATCH 02/14] modified read timeout to 180 sec --- .../serverless-components/aws-cloudfront/src/getOriginConfig.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/serverless-components/aws-cloudfront/src/getOriginConfig.ts b/packages/serverless-components/aws-cloudfront/src/getOriginConfig.ts index 3d399fc2bd..54a356ba4b 100644 --- a/packages/serverless-components/aws-cloudfront/src/getOriginConfig.ts +++ b/packages/serverless-components/aws-cloudfront/src/getOriginConfig.ts @@ -78,7 +78,7 @@ export const getOriginConfig = ( Quantity: 1, Items: ["TLSv1.2"] }, - OriginReadTimeout: 60, + OriginReadTimeout: 180, OriginKeepaliveTimeout: 60 }; } From cdf8fced0164dff07fd49fd3a64abc9abee0cf46 Mon Sep 17 00:00:00 2001 From: Joseph Palomino Date: Tue, 13 Dec 2022 21:02:44 -0600 Subject: [PATCH 03/14] add new paths --- .../nextjs-component/src/component.ts | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index bd75712b00..4f9b86ac92 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -850,6 +850,66 @@ class NextjsComponent extends Component { } }; + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/promos*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; + + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/about-us*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; + + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/support*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; + // If we are using consolidated API pages (within default lambda), we need to ensure api/* behavior is set correctly. // Note that if there are no consolidated API pages then existing api/* is not deleted. // We do so for a couple reasons: From f6291b0546bdf1a2844600e99dfabf1ba1ec81b7 Mon Sep 17 00:00:00 2001 From: Joseph Palomino Date: Fri, 27 Jan 2023 08:13:50 -0600 Subject: [PATCH 04/14] add config for certifications launch --- .../nextjs-component/src/component.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index 4f9b86ac92..c625002466 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -889,6 +889,26 @@ class NextjsComponent extends Component { "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` } }; + + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/certifications*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; cloudFrontOrigins[1].pathPatterns[ this.pathPattern("/support*", routesManifest) From 4c3ed76477eec9420f10ecc96106daf1ea277d8e Mon Sep 17 00:00:00 2001 From: Joseph Palomino Date: Thu, 9 Mar 2023 11:03:36 -0600 Subject: [PATCH 05/14] add training and events --- .../nextjs-component/src/component.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index c625002466..c174fcf50c 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -909,6 +909,26 @@ class NextjsComponent extends Component { "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` } }; + + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/training-and-events*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; cloudFrontOrigins[1].pathPatterns[ this.pathPattern("/support*", routesManifest) From 1cbaa02103b22166248d8a4045d1e78bd19809c9 Mon Sep 17 00:00:00 2001 From: john-parker3 <101754302+john-parker3@users.noreply.github.com> Date: Thu, 16 Mar 2023 16:37:31 -0600 Subject: [PATCH 06/14] add sitemaps path (#2) --- .../nextjs-component/src/component.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index c174fcf50c..8f301284a0 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -909,6 +909,25 @@ class NextjsComponent extends Component { "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` } }; + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/sitemaps*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; cloudFrontOrigins[1].pathPatterns[ this.pathPattern("/training-and-events*", routesManifest) From d6872568f5cee1f77faf924863f40e92dc38ab12 Mon Sep 17 00:00:00 2001 From: Joseph Palomino Date: Thu, 20 Jul 2023 11:24:56 -0500 Subject: [PATCH 07/14] remove cookies cache --- .../nextjs-component/src/component.ts | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index 8f301284a0..e40b41e94f 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -837,7 +837,6 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -857,7 +856,6 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -877,7 +875,25 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; + + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/resources*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -897,7 +913,6 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -916,7 +931,6 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -936,7 +950,6 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -956,7 +969,6 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -994,7 +1006,6 @@ class NextjsComponent extends Component { headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], - cookies: "all", queryString: true }, // lambda@edge key is last and therefore cannot be overridden From f4af677841f1fd56407b8cf681c1a3796f3d3fcf Mon Sep 17 00:00:00 2001 From: Joseph Palomino Date: Fri, 21 Jul 2023 11:42:09 -0500 Subject: [PATCH 08/14] Revert "remove cookies cache" This reverts commit d6872568f5cee1f77faf924863f40e92dc38ab12. --- .../nextjs-component/src/component.ts | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index e40b41e94f..8f301284a0 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -837,6 +837,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -856,6 +857,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -875,25 +877,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - headers: routesManifest.i18n - ? ["Accept-Language", "Authorization", "Host"] - : ["Authorization", "Host"], - queryString: true - }, - // lambda@edge key is last and therefore cannot be overridden - "lambda@edge": { - "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, - "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` - } - }; - - cloudFrontOrigins[1].pathPatterns[ - this.pathPattern("/resources*", routesManifest) - ] = { - minTTL: 0, - defaultTTL: 0, - maxTTL: 86400, - forward: { + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -913,6 +897,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -931,6 +916,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -950,6 +936,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -969,6 +956,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -1006,6 +994,7 @@ class NextjsComponent extends Component { headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], + cookies: "all", queryString: true }, // lambda@edge key is last and therefore cannot be overridden From 1adc72a367a428a92635b4e89a6ca9f27f8a8852 Mon Sep 17 00:00:00 2001 From: Joseph Palomino Date: Fri, 21 Jul 2023 11:45:04 -0500 Subject: [PATCH 09/14] update cookes to none --- .../nextjs-component/src/component.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index 8f301284a0..8791a10640 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -837,7 +837,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", + cookies: "none", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -857,7 +857,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", + cookies: "none", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -877,7 +877,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", + cookies: "none", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -897,7 +897,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", + cookies: "none", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -916,7 +916,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", + cookies: "none", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -936,7 +936,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", + cookies: "none", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -956,7 +956,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "all", + cookies: "none", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], From fc90dfaa024a49d931df7676802680efc32d8f8c Mon Sep 17 00:00:00 2001 From: Joseph Palomino Date: Thu, 27 Jul 2023 08:45:58 -0500 Subject: [PATCH 10/14] fix resources --- .../nextjs-component/src/component.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index 8791a10640..4cc28f4668 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -850,6 +850,26 @@ class NextjsComponent extends Component { } }; + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/resources*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "none", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; + cloudFrontOrigins[1].pathPatterns[ this.pathPattern("/promos*", routesManifest) ] = { From cea73f6e9ac2584f9d174604f37706188b489307 Mon Sep 17 00:00:00 2001 From: Joseph Palomino Date: Tue, 1 Aug 2023 08:38:22 -0500 Subject: [PATCH 11/14] update cache --- .../nextjs-component/src/component.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index 4cc28f4668..27af161895 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -837,7 +837,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "none", + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -857,7 +857,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "none", + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -877,7 +877,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "none", + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -897,7 +897,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "none", + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -917,7 +917,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "none", + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -936,7 +936,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "none", + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -956,7 +956,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "none", + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], @@ -976,7 +976,7 @@ class NextjsComponent extends Component { defaultTTL: 0, maxTTL: 86400, forward: { - cookies: "none", + cookies: "all", headers: routesManifest.i18n ? ["Accept-Language", "Authorization", "Host"] : ["Authorization", "Host"], From 57fa570bf016ae2a808bfd19636f175e9c42170e Mon Sep 17 00:00:00 2001 From: john-parker3 <101754302+john-parker3@users.noreply.github.com> Date: Thu, 5 Oct 2023 15:49:04 -0600 Subject: [PATCH 12/14] add lp path (#5) --- .../nextjs-component/src/component.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index 27af161895..355fd465af 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -989,6 +989,26 @@ class NextjsComponent extends Component { } }; + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/lp*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; + // If we are using consolidated API pages (within default lambda), we need to ensure api/* behavior is set correctly. // Note that if there are no consolidated API pages then existing api/* is not deleted. // We do so for a couple reasons: From 869b6a8d725ea556b427d6fac27d69d52b412ade Mon Sep 17 00:00:00 2001 From: john-parker3 <101754302+john-parker3@users.noreply.github.com> Date: Tue, 31 Oct 2023 09:48:23 -0600 Subject: [PATCH 13/14] add search and fix prettier lint errors (#6) --- .../nextjs-component/src/component.ts | 61 ++++++++++++------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index 355fd465af..8cd2110a6f 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -424,7 +424,6 @@ class NextjsComponent extends Component { ]; console.log(cloudFrontOrigins[0]); - cloudFrontOrigins[1].pathPatterns[ this.pathPattern("_next/static/*", routesManifest) @@ -839,8 +838,8 @@ class NextjsComponent extends Component { forward: { cookies: "all", headers: routesManifest.i18n - ? ["Accept-Language", "Authorization", "Host"] - : ["Authorization", "Host"], + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], queryString: true }, // lambda@edge key is last and therefore cannot be overridden @@ -859,8 +858,8 @@ class NextjsComponent extends Component { forward: { cookies: "all", headers: routesManifest.i18n - ? ["Accept-Language", "Authorization", "Host"] - : ["Authorization", "Host"], + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], queryString: true }, // lambda@edge key is last and therefore cannot be overridden @@ -879,8 +878,8 @@ class NextjsComponent extends Component { forward: { cookies: "all", headers: routesManifest.i18n - ? ["Accept-Language", "Authorization", "Host"] - : ["Authorization", "Host"], + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], queryString: true }, // lambda@edge key is last and therefore cannot be overridden @@ -899,8 +898,8 @@ class NextjsComponent extends Component { forward: { cookies: "all", headers: routesManifest.i18n - ? ["Accept-Language", "Authorization", "Host"] - : ["Authorization", "Host"], + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], queryString: true }, // lambda@edge key is last and therefore cannot be overridden @@ -919,8 +918,8 @@ class NextjsComponent extends Component { forward: { cookies: "all", headers: routesManifest.i18n - ? ["Accept-Language", "Authorization", "Host"] - : ["Authorization", "Host"], + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], queryString: true }, // lambda@edge key is last and therefore cannot be overridden @@ -938,8 +937,8 @@ class NextjsComponent extends Component { forward: { cookies: "all", headers: routesManifest.i18n - ? ["Accept-Language", "Authorization", "Host"] - : ["Authorization", "Host"], + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], queryString: true }, // lambda@edge key is last and therefore cannot be overridden @@ -958,8 +957,8 @@ class NextjsComponent extends Component { forward: { cookies: "all", headers: routesManifest.i18n - ? ["Accept-Language", "Authorization", "Host"] - : ["Authorization", "Host"], + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], queryString: true }, // lambda@edge key is last and therefore cannot be overridden @@ -968,7 +967,7 @@ class NextjsComponent extends Component { "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` } }; - + cloudFrontOrigins[1].pathPatterns[ this.pathPattern("/support*", routesManifest) ] = { @@ -978,8 +977,8 @@ class NextjsComponent extends Component { forward: { cookies: "all", headers: routesManifest.i18n - ? ["Accept-Language", "Authorization", "Host"] - : ["Authorization", "Host"], + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], queryString: true }, // lambda@edge key is last and therefore cannot be overridden @@ -998,8 +997,28 @@ class NextjsComponent extends Component { forward: { cookies: "all", headers: routesManifest.i18n - ? ["Accept-Language", "Authorization", "Host"] - : ["Authorization", "Host"], + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; + + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/search*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], queryString: true }, // lambda@edge key is last and therefore cannot be overridden @@ -1101,7 +1120,7 @@ class NextjsComponent extends Component { const cloudFrontOutputs = await cloudFront({ bucketRegion: bucketRegion, distributionId: cloudFrontDistributionId, - defaults: { + defaults: { minTTL: 0, defaultTTL: 0, maxTTL: 31536000, From 62f1eab2819c4a7c972748c1dd2f2e23a446a16a Mon Sep 17 00:00:00 2001 From: vikrantsinghaapc <41428323+vikrantsinghaapc@users.noreply.github.com> Date: Mon, 3 Jun 2024 22:10:49 +0530 Subject: [PATCH 14/14] create serverless PR changes --- .../nextjs-component/src/component.ts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index 8cd2110a6f..b5482e99f8 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -1028,6 +1028,46 @@ class NextjsComponent extends Component { } }; + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/shop/*", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; + + cloudFrontOrigins[1].pathPatterns[ + this.pathPattern("/shop", routesManifest) + ] = { + minTTL: 0, + defaultTTL: 0, + maxTTL: 86400, + forward: { + cookies: "all", + headers: routesManifest.i18n + ? ["Accept-Language", "Authorization", "Host"] + : ["Authorization", "Host"], + queryString: true + }, + // lambda@edge key is last and therefore cannot be overridden + "lambda@edge": { + "origin-request": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`, + "origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}` + } + }; + // If we are using consolidated API pages (within default lambda), we need to ensure api/* behavior is set correctly. // Note that if there are no consolidated API pages then existing api/* is not deleted. // We do so for a couple reasons: