From befcfdb85fb7a7c777dc24d9ef22ee7bc82ea1ba Mon Sep 17 00:00:00 2001 From: Bauke Date: Tue, 18 Oct 2022 22:23:41 +0200 Subject: [PATCH] Always remove www. from hostname matching. --- source/redirect/base.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/redirect/base.ts b/source/redirect/base.ts index ec03ac3..0b75f86 100644 --- a/source/redirect/base.ts +++ b/source/redirect/base.ts @@ -26,7 +26,10 @@ export abstract class Redirect

{ public isMatch(url: URL): boolean { if (this.parameters.matcherType === 'hostname') { - return url.hostname === this.parameters.toMatch; + const hostname = url.hostname.startsWith('www.') + ? url.hostname.slice(4) + : url.hostname; + return hostname === this.parameters.toMatch; } return false;