From 0bf25e4bc337b704ddc07b6d123199def6865f47 Mon Sep 17 00:00:00 2001 From: cowboy Date: Fri, 28 Aug 2020 20:36:29 +0800 Subject: [PATCH] Fix router not working on some protocol Added support for protocols other than http and https Fixes #16456 --- .../next/next-server/lib/router/utils/parse-relative-url.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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') }