Allow multiple tracker names.

This commit is contained in:
Mike Cao 2023-04-20 01:12:43 -07:00
parent f0d13efc7a
commit dbc19e4ffd
2 changed files with 11 additions and 6 deletions

View file

@ -24,8 +24,9 @@ function customScriptName(req) {
if (scriptName) {
const url = req.nextUrl.clone();
const { pathname } = url;
const names = scriptName.split(',').map(name => name.trim());
if (pathname.endsWith(scriptName)) {
if (names.find(name => pathname.endsWith(name))) {
url.pathname = '/script.js';
return NextResponse.rewrite(url);
}