From d31c36fe88d13c94168690a6b150b78ef27c09d8 Mon Sep 17 00:00:00 2001 From: engdevopsaapc <117998163+engdevopsaapc@users.noreply.github.com> Date: Mon, 3 Jun 2024 20:49:56 +0530 Subject: [PATCH] Update component.ts --- .../nextjs-component/src/component.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/packages/serverless-components/nextjs-component/src/component.ts b/packages/serverless-components/nextjs-component/src/component.ts index 8cd2110a6f..d0d60affa6 100644 --- a/packages/serverless-components/nextjs-component/src/component.ts +++ b/packages/serverless-components/nextjs-component/src/component.ts @@ -1027,6 +1027,44 @@ class NextjsComponent extends Component { "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}` + } + }; + 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.