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
This commit is contained in:
Linus Flood
2025-08-22 09:47:54 +00:00
parent caffa1821f
commit e2544f9f89
10 changed files with 238 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
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)/)
}