We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 0a60168 + de19aa3 commit c06dc28Copy full SHA for c06dc28
1 file changed
apps/trust/src/middleware.ts
@@ -1,6 +1,7 @@
1
import { NextRequest, NextResponse } from "next/server";
2
3
const DOMAIN_TO_ORG_ID_MAP = {
4
+ "fba6-145-40-151-14.ngrok-free.app": "org_681e8e3282ad3e9eb78bc58c",
5
"security.trycomp.ai": "org_681e8e3282ad3e9eb78bc58c",
6
"trust.trycomp.ai": null,
7
};
@@ -19,9 +20,9 @@ export async function middleware(request: NextRequest) {
19
20
DOMAIN_TO_ORG_ID_MAP[hostname as keyof typeof DOMAIN_TO_ORG_ID_MAP];
21
22
if (orgIdForCustomDomain) {
- console.log(
23
- `Rewriting ${hostname}${url.pathname} to /${orgIdForCustomDomain}${url.pathname}`,
24
- );
+ if (url.pathname.startsWith(`/${orgIdForCustomDomain}`)) {
+ return NextResponse.next();
25
+ }
26
url.pathname = `/${orgIdForCustomDomain}${url.pathname}`;
27
return NextResponse.rewrite(url);
28
}
0 commit comments