wip: remove starts with function

This commit is contained in:
swve 2023-04-12 23:53:28 +02:00 committed by Badr B
parent f519c5f8bf
commit 28d1863be0

View file

@ -35,14 +35,7 @@ export default function middleware(req: NextRequest) {
return NextResponse.rewrite(url, { headers: { orgslug: currentHost } });
}
if (url.pathname.startsWith("/organizations")) {
if (!isSelfHosted) {
currentHost = "";
}
url.pathname = url.pathname.replace("/organizations", `/organizations${currentHost}`).replace("localhost:3000", "");
return NextResponse.rewrite(url);
}
if (isSelfHosted) {
currentHost = defaultOrg || currentHost;