File tree 1 file changed +8
-1
lines changed
packages/runtime/src/templates
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 1
- import { PrerenderManifest } from 'next/dist/build'
1
+ // eslint-disable-next-line n/no-deprecated-api -- this is what Next.js uses as well
2
+ import { parse } from 'url'
3
+
4
+ import type { PrerenderManifest } from 'next/dist/build'
2
5
import type { BaseNextResponse } from 'next/dist/server/base-http'
3
6
import type { NodeRequestHandler , Options } from 'next/dist/server/next-server'
4
7
@@ -36,6 +39,10 @@ const getNetlifyNextServer = (NextServer: NextServerType) => {
36
39
public getRequestHandler ( ) : NodeRequestHandler {
37
40
const handler = super . getRequestHandler ( )
38
41
return async ( req , res , parsedUrl ) => {
42
+ if ( ! parsedUrl && typeof req ?. headers ?. [ 'x-middleware-rewrite' ] === 'string' ) {
43
+ parsedUrl = parse ( req . headers [ 'x-middleware-rewrite' ] , true )
44
+ }
45
+
39
46
// preserve the URL before Next.js mutates it for i18n
40
47
const { url, headers } = req
41
48
You can’t perform that action at this time.
0 commit comments