File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
packages/runtime/src/templates Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -270,6 +270,9 @@ export const buildResponse = async ({
270
270
}
271
271
res . headers . set ( 'x-middleware-rewrite' , relativeUrl )
272
272
273
+ request . headers . set ( 'x-original-path' , new URL ( request . url , `http://n` ) . pathname )
274
+ request . headers . set ( 'x-middleware-rewrite' , rewrite )
275
+
273
276
return addMiddlewareHeaders ( context . rewrite ( rewrite ) , res )
274
277
}
275
278
Original file line number Diff line number Diff line change @@ -189,6 +189,13 @@ export const normalizePath = (event: HandlerEvent) => {
189
189
return originalPath
190
190
}
191
191
}
192
+
193
+ if ( event . headers [ 'x-original-path' ] ) {
194
+ if ( event . headers [ 'x-next-debug-logging' ] ) {
195
+ console . log ( 'Original path:' , event . headers [ 'x-original-path' ] )
196
+ }
197
+ return event . headers [ 'x-original-path' ]
198
+ }
192
199
// Ensure that paths are encoded - but don't double-encode them
193
200
return new URL ( event . rawUrl ) . pathname
194
201
}
You can’t perform that action at this time.
0 commit comments