-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathproxy.ts
More file actions
29 lines (24 loc) · 892 Bytes
/
proxy.ts
File metadata and controls
29 lines (24 loc) · 892 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
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
export const SETUP_REGEX = /\/(setup|signin\/plex\/loading)/;
export const publicRoutes =
/(\/|signin(\/plex\/loading)?|signup|resetpassword\/?(.*)?|setup|signin(\/plex\/loading)?|help\/?(.*)?)$/;
export function proxy(req: NextRequest) {
const pathname = req.nextUrl.pathname;
// Always allow static files and Next.js internals
if (
pathname.startsWith('/_next') ||
pathname.startsWith('/api') ||
pathname.startsWith('/favicon.ico') ||
pathname.startsWith('/robots.txt') ||
pathname.startsWith('/offline.html') ||
pathname.startsWith('/img') ||
pathname.startsWith('/external')
) {
return NextResponse.next();
}
return NextResponse.next();
}
export const config = {
matcher: ['/((?!api|_next/static|_next/image|img/|external/|.*\\.png$).*)'],
};