Skip to content

Commit e52be55

Browse files
authored
fix(middleware): exclude /themes and /i18n from proxy (#917)
1 parent 9eb1eb3 commit e52be55

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

middleware.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
// Configuration for Vercel Edge Middleware (same as original)
22
export const config = {
3-
// Matcher: all paths except those starting with /api
4-
matcher: ['/((?!api/).*)'],
3+
// Matcher: all paths except those starting with '/api', '/themes', and '/i18n'
4+
matcher: ['/((?!api/|themes/|i18n/).*)'],
55
};
66

77
export default async function middleware(request: Request): Promise<Response | void> {
88
const url = new URL(request.url);
99
const { pathname, search } = url;
1010

11-
// Additional check to ensure /api paths don't pass through
12-
if (pathname.startsWith('/api')) {
11+
// Excludes paths that should be taken from the API project (not rewritten)
12+
if (
13+
pathname.startsWith('/api') ||
14+
pathname.startsWith('/themes/') ||
15+
pathname.startsWith('/i18n/')
16+
) {
1317
return; // let the request proceed to the serverless function
1418
}
1519

0 commit comments

Comments
 (0)