-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmiddleware.ts
More file actions
31 lines (27 loc) · 966 Bytes
/
middleware.ts
File metadata and controls
31 lines (27 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function middleware(_: NextRequest) {
const response = NextResponse.next();
// Add no-cache headers to all responses
response.headers.set(
'Cache-Control',
'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'
);
response.headers.set('Pragma', 'no-cache');
response.headers.set('Expires', '0');
response.headers.set('X-Content-Type-Options', 'nosniff');
return response;
}
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
* - public folder files
*/
'/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|woff|woff2|ttf|otf|eot)).*)',
],
};