18 lines
528 B
TypeScript
18 lines
528 B
TypeScript
import { NextResponse } from "next/server"
|
|
import type { NextRequest } from "next/server"
|
|
import { isProductionHost, normalizeHost } from "@/lib/seo-config"
|
|
|
|
export function middleware(request: NextRequest) {
|
|
const response = NextResponse.next()
|
|
const host = normalizeHost(request.headers.get("host"))
|
|
|
|
if (!isProductionHost(host)) {
|
|
response.headers.set("X-Robots-Tag", "noindex, nofollow, noarchive")
|
|
}
|
|
|
|
return response
|
|
}
|
|
|
|
export const config = {
|
|
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
}
|