Always remove www. from hostname matching.

This commit is contained in:
Bauke 2022-10-18 22:23:41 +02:00
parent f261052331
commit befcfdb85f
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 4 additions and 1 deletions

View File

@ -26,7 +26,10 @@ export abstract class Redirect<P extends RedirectParameters> {
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;