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] 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: