1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 09:25:22 -04:00
jarv.is/middleware.ts
Jake Jarvis 377db1adcb
Revert "add sentry to investigate 500 errors"
This reverts commit 8f946d50d8f5b8252f39f277ab5d538e4fc98d8e.
2025-03-06 08:27:48 -05:00

24 lines
730 B
TypeScript

import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
import siteConfig from "./lib/config";
export function middleware(request: NextRequest) {
const response = NextResponse.next();
// https://gitweb.torproject.org/tor-browser-spec.git/tree/proposals/100-onion-location-header.txt
if (siteConfig.onionDomain) {
response.headers.set("Onion-Location", `${siteConfig.onionDomain}${request.nextUrl.pathname}`);
}
// debugging 🥛
response.headers.set("x-got-milk", "2%");
return response;
}
export const config = {
// save compute time by skipping middleware for static and metadata files
matcher: ["/((?!_next/static|_next/image|_vercel|static|favicon.ico).*)"],
};