diff --git a/apps/trust/src/middleware.ts b/apps/trust/src/middleware.ts index 10ab2ef88e..cf21bfd7b2 100644 --- a/apps/trust/src/middleware.ts +++ b/apps/trust/src/middleware.ts @@ -1,6 +1,7 @@ import { NextRequest, NextResponse } from "next/server"; const DOMAIN_TO_ORG_ID_MAP = { + "fba6-145-40-151-14.ngrok-free.app": "org_681e8e3282ad3e9eb78bc58c", "security.trycomp.ai": "org_681e8e3282ad3e9eb78bc58c", "trust.trycomp.ai": null, }; @@ -19,9 +20,9 @@ export async function middleware(request: NextRequest) { DOMAIN_TO_ORG_ID_MAP[hostname as keyof typeof DOMAIN_TO_ORG_ID_MAP]; if (orgIdForCustomDomain) { - console.log( - `Rewriting ${hostname}${url.pathname} to /${orgIdForCustomDomain}${url.pathname}`, - ); + if (url.pathname.startsWith(`/${orgIdForCustomDomain}`)) { + return NextResponse.next(); + } url.pathname = `/${orgIdForCustomDomain}${url.pathname}`; return NextResponse.rewrite(url); }