File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
packages/open-next/src/core/routing Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " open-next " : patch
3
+ ---
4
+
5
+ fix wrong locale in middleware
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ export async function handleMiddleware(
59
59
) : Promise < MiddlewareOutputEvent | InternalResult > {
60
60
const { rawPath, query } = internalEvent ;
61
61
const normalizedPath = normalizeLocalePath ( rawPath ) ;
62
+ // We only need the normalizedPath to check if the middleware should run
62
63
const hasMatch = middleMatch . some ( ( r ) => r . test ( normalizedPath ) ) ;
63
64
if ( ! hasMatch ) return internalEvent ;
64
65
// We bypass the middleware if the request is internal
@@ -67,7 +68,7 @@ export async function handleMiddleware(
67
68
const host = internalEvent . headers . host
68
69
? `https://${ internalEvent . headers . host } `
69
70
: "http://localhost:3000" ;
70
- const initialUrl = new URL ( normalizedPath , host ) ;
71
+ const initialUrl = new URL ( rawPath , host ) ;
71
72
initialUrl . search = convertToQueryString ( query ) ;
72
73
const url = initialUrl . toString ( ) ;
73
74
// console.log("url", url, normalizedPath);
You can’t perform that action at this time.
0 commit comments