CoolFace
Apppublic

enzostvs/deepsite

sourceHugging Facemitupdated 8mo agoView on Hugging Face
17klikes
middleware.ts21 linesDownload Raw Back to root
1import { NextResponse } from "next/server";2import type { NextRequest } from "next/server";3 4export function middleware(request: NextRequest) {5  const headers = new Headers(request.headers);6  headers.set("x-current-host", request.nextUrl.host);7  8  const response = NextResponse.next({ headers });9 10  if (request.nextUrl.pathname.startsWith('/_next/static')) {11    response.headers.set('Cache-Control', 'public, max-age=31536000, immutable');12  }13  response.headers.set('X-Canonical-URL', `https://deepsite.hf.co${request.nextUrl.pathname}`);14  15  return response;16}17 18export const config = {19  matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],20};21