Skip to content

Commit

Permalink
add search and fix prettier lint errors (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-parker3 authored Oct 31, 2023
1 parent 57fa570 commit 869b6a8
Showing 1 changed file with 40 additions and 21 deletions.
61 changes: 40 additions & 21 deletions packages/serverless-components/nextjs-component/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ class NextjsComponent extends Component {
];

console.log(cloudFrontOrigins[0]);


cloudFrontOrigins[1].pathPatterns[
this.pathPattern("_next/static/*", routesManifest)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -968,7 +967,7 @@ class NextjsComponent extends Component {
"origin-response": `${defaultEdgeLambdaOutputs.arn}:${defaultEdgeLambdaPublishOutputs.version}`
}
};

cloudFrontOrigins[1].pathPatterns[
this.pathPattern("/support*", routesManifest)
] = {
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -1101,7 +1120,7 @@ class NextjsComponent extends Component {
const cloudFrontOutputs = await cloudFront({
bucketRegion: bucketRegion,
distributionId: cloudFrontDistributionId,
defaults: {
defaults: {
minTTL: 0,
defaultTTL: 0,
maxTTL: 31536000,
Expand Down

0 comments on commit 869b6a8

Please sign in to comment.