Next.js Discord

Discord Forum

my middleware keeps redirecting my /sitemap.xml route

Unanswered
Sam Apostel posted this in #help-forum
Open in Discord
I have a redirect in middleware that moves all users to a specific page for their language. In development this works fine, but in production this fails for the /sitemap.xml route

this is the middleware matcher:
export const config = {
  matcher: [
    '/((?!api|_next/static|_next/image|assets|favicon.ico|sitemap.xml|sw.js|site.webmanifest).*)',
  ],
};


Note: This does work for all the other cases like /favicon.ico

Any ideas on why vercel still redirects this request?

0 Replies