feat(SW-3192): Checks if user exists, otherwise logout and show error * feat(SW-3192): Checks if user exists, otherwise logout and show error
21 lines
555 B
TypeScript
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)/)
|
|
}
|