diff --git a/src/utils/matching/matchRequestUrl.ts b/src/utils/matching/matchRequestUrl.ts index cd590a00b..8f9c29ae0 100644 --- a/src/utils/matching/matchRequestUrl.ts +++ b/src/utils/matching/matchRequestUrl.ts @@ -40,13 +40,13 @@ export function coercePath(path: string): string { * Escape the port so that "path-to-regexp" can match * absolute URLs including port numbers. */ - .replace(/([^\/])(:)(?=\d+)/g, '$1\\$2') + .replace(/([^\/])(:)(?=\d+)/, '$1\\$2') /** * Escape the protocol so that "path-to-regexp" could match * absolute URL. * @see https://github.com/pillarjs/path-to-regexp/issues/259 */ - .replace(/^([^\/]+)(:)(?=\/\/)/g, '$1\\$2') + .replace(/^([^\/]+)(:)(?=\/\/)/, '$1\\$2') ) }