diff --git a/packages/next/next-server/lib/router/utils/parse-relative-url.ts b/packages/next/next-server/lib/router/utils/parse-relative-url.ts index 6475ea6630fa5a..d7a709d426cc76 100644 --- a/packages/next/next-server/lib/router/utils/parse-relative-url.ts +++ b/packages/next/next-server/lib/router/utils/parse-relative-url.ts @@ -23,7 +23,9 @@ export function parseRelativeUrl(url: string, base?: string) { } = new URL(url, resolvedBase) if ( origin !== DUMMY_BASE.origin || - (protocol !== 'http:' && protocol !== 'https:') + (protocol !== 'http:' && + protocol !== 'https:' && + protocol !== DUMMY_BASE.protocol) ) { throw new Error('invariant: invalid relative URL') }