Skip to content

Commit

Permalink
Update nextjs version and middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
kaje94 committed Dec 12, 2023
1 parent 5322ff4 commit d148206
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 42 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"embla-carousel-react": "8.0.0-rc14",
"fast-average-color": "^9.4.0",
"fslightbox-react": "^1.7.6",
"next": "14.0.3",
"next": "14.0.4",
"next-international": "^1.1.4",
"next-recaptcha-v3": "^1.3.0",
"postcss": "8.4.23",
Expand Down
81 changes: 41 additions & 40 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ export async function middleware(request: NextRequest) {
res.headers.set("x-pathname", request.nextUrl.pathname);
res.headers.set("x-locale", pathLocale);
res.headers.set("x-country-name", matchingLocal[0]);
res.headers.set("Locale", "en");

// Following is needed for next-international to function
res.headers.set("X-Next-Locale", "en");
if (request.cookies.get("Next-Locale")?.value !== "en") {
res.cookies.set("Next-Locale", "en", { sameSite: "strict" });
}

return res;
}
Expand Down

0 comments on commit d148206

Please sign in to comment.