File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Configuration for Vercel Edge Middleware (same as original)
22export 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
77export 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
You can’t perform that action at this time.
0 commit comments