Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

fix(web): i18n error on main page (#896)

Tom Lienard63c871b57ff1
diff --git a/apps/web/src/middleware.ts b/apps/web/src/middleware.ts
index 0583bfc2..da0c0489 100644
--- a/apps/web/src/middleware.ts
+++ b/apps/web/src/middleware.ts
@@ -8,6 +8,12 @@ const I18nMiddleware = createI18nMiddleware({
});
export function middleware(req: NextRequest) {
+ // Ignore requests to the Vercel user metadata endpoint to prevent
+ // i18n locale error extracting the locale as ".well-known"
+ if (req.nextUrl.pathname === '/.well-known/vercel-user-meta') {
+ return new Response(null, { status: 404 });
+ }
+
const { VERCEL_ENV: vercelEnv, STAGING: staging = false } = process.env;
// skip blocking the request if local or preview or staging
@@ -19,5 +25,5 @@ export function middleware(req: NextRequest) {
}
export const config = {
- matcher: ['/((?!api|static|.*\\..*|_next|favicon.ico|robots.txt).*)'],
+ matcher: ['/((?!api|static|site.webmanifest|_next|favicon.ico|robots.txt).*)'],
};