Spaces:
Running
Running
File size: 758 Bytes
c10f8f8 33718e1 c10f8f8 33718e1 8bce833 0698bd6 8bce833 6cca3b1 8bce833 c10f8f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
export function middleware(request: NextRequest) {
const headers = new Headers(request.headers);
headers.set("x-current-host", request.nextUrl.host);
headers.set("x-invoke-path", request.nextUrl.pathname + request.nextUrl.search);
const response = NextResponse.next({ headers });
if (request.nextUrl.pathname.startsWith('/_next/static')) {
response.headers.set('Cache-Control', 'public, max-age=31536000, immutable');
}
response.headers.set('X-Canonical-URL', `https://huggingface.co/deepsite${request.nextUrl.pathname}`);
return response;
}
export const config = {
matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],
};
|