Files
nobat724_front/proxy.js
T
hamedandClaude Fable 5 4df9439087 refactor: rename middleware to proxy for Next 16
Next 16 deprecates the middleware file convention; a leftover
middleware.js is silently ignored, which would break the x-pathname
header that canonical URL generation depends on.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 09:57:30 +03:30

24 lines
800 B
JavaScript

import { NextResponse } from 'next/server';
export function proxy(request) {
const response = NextResponse.next();
// Add pathname to headers so we can access it in getCanonicalUrl
response.headers.set('x-pathname', request.nextUrl.pathname);
return response;
}
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - api (API routes)
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
* - panel, dashboard, login, login-verify (auth-gated/noindex pages — canonical URL has no SEO value here)
*/
'/((?!api|_next/static|_next/image|favicon.ico|panel|dashboard|login|login-verify).*)',
],
};