From 28a54113e15a62891ac2ed1f5af49831af48460c Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 2 Jan 2023 15:48:06 -0500 Subject: [PATCH] fix: Always redirect to custom domain on server if set --- server/routes/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/routes/index.ts b/server/routes/index.ts index 4514cc8cf..6daa6154c 100644 --- a/server/routes/index.ts +++ b/server/routes/index.ts @@ -132,6 +132,12 @@ router.get("*", async (ctx, next) => { }) : undefined; + // Redirect all requests to custom domain if one is set + if (team?.domain && team.domain !== ctx.hostname) { + ctx.redirect(ctx.href.replace(ctx.hostname, team.domain)); + return; + } + return renderApp(ctx, next, { analytics, });