Replies: 1 comment
-
Possible solution (not sure that best way):
export const config = {
matcher: [
"/((?!api|_next|_vercel|monitoring|.*\\..*).*)",
"/(en|ru|hy)/:path*",
],
};
const url = request.nextUrl.clone();
const { pathname } = url;
request.headers.set("x-pathname", pathname);
// remove "use client";
const defaultLocale = "en";
export default function NotFound() {
const pathname = headers().get("x-pathname");
if (pathname === null)
throw TypeError(`Unexpected null value for x-pathname header`);
redirect(`/${defaultLocale}${pathname}`);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Due to this instruction:
currently my unlocalized requests do these things:
I want be able to make server respond with 307 and location header without making redirect after loading 404 page from server.
How can I achieve this behavior?
Beta Was this translation helpful? Give feedback.
All reactions