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:
20
apps/scandic-web/middlewares/errorPages.ts
Normal file
20
apps/scandic-web/middlewares/errorPages.ts
Normal 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)/)
|
||||
}
|
||||
Reference in New Issue
Block a user