mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
fix: Unused subdomains should redirect to root (#11259)
* fix: Unused subdomains should redirect to root * test
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user