Files
web/apps/scandic-web/middlewares/errorPages.ts
Linus Flood e2544f9f89 Merged in feat/sw-3192-no-user (pull request #2680)
feat(SW-3192): Checks if user exists, otherwise logout and show error

* feat(SW-3192): Checks if user exists, otherwise logout and show error
2025-08-22 09:47:54 +00:00

21 lines
555 B
TypeScript

import { type NextMiddleware, NextResponse } from "next/server"
import { getDefaultRequestHeaders } from "./utils"
import type { MiddlewareMatcher } from "@/types/middleware"
export const middleware: NextMiddleware = async (request) => {
const headers = getDefaultRequestHeaders(request)
headers.set("X-Robots-Tag", "noindex, nofollow")
return NextResponse.next({
request: {
headers,
},
})
}
export const matcher: MiddlewareMatcher = (request) => {
return !!request.nextUrl.pathname.match(/^\/(da|de|en|fi|no|sv)\/(error)/)
}