fix: Unused subdomains should redirect to root (#11259)

* fix: Unused subdomains should redirect to root

* test
This commit is contained in:
Tom Moor
2026-01-24 09:59:20 -05:00
committed by GitHub
parent 3118721b21
commit 74ce4052c4
+9 -1
View File
@@ -155,8 +155,16 @@ router.get("*", async (ctx, next) => {
const team = await getTeamFromContext(ctx);
if (env.isCloudHosted) {
// Redirect to main domain if no team is found
if (!team || team.isSuspended) {
if (env.isProduction && ctx.hostname !== parseDomain(env.URL).host) {
ctx.redirect(env.URL);
return;
}
}
// Redirect all requests to custom domain if one is set
if (team?.domain) {
else if (team?.domain) {
if (team.domain !== ctx.hostname) {
ctx.redirect(ctx.href.replace(ctx.hostname, team.domain));
return;