perf: Remove unneeded query before custom domain redirect
This commit is contained in:
@@ -130,6 +130,13 @@ router.get("/s/:shareId/*", renderShare);
|
||||
// catch all for application
|
||||
router.get("*", async (ctx, next) => {
|
||||
const team = await getTeamFromContext(ctx);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
const analytics = team
|
||||
? await Integration.findOne({
|
||||
where: {
|
||||
@@ -139,12 +146,6 @@ 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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user