♻️ Force disable redirects when domain is missing attached resource domain

This commit is contained in:
Fred KISSIE
2026-09-23 20:49:45 +02:00
parent ca18320ca3
commit 14fda9cec0
4 changed files with 74 additions and 62 deletions
+8 -2
View File
@@ -40,7 +40,7 @@ import {
domains
} from "@server/db";
import { alias } from "@server/db";
import { and, desc, eq, inArray, isNull, or, sql } from "drizzle-orm";
import { and, desc, eq, inArray, isNull, not, or, sql } from "drizzle-orm";
import logger from "@server/logger";
export type ResourceWithAuth = {
@@ -116,7 +116,13 @@ export async function getRedirectsByHost(
eq(redirects.enabled, true),
// Traefik drops resource-attached redirects along with a
// disabled resource; do the same here.
or(isNull(redirects.resourceId), eq(resources.enabled, true)),
or(
isNull(redirects.resourceId),
and(
eq(resources.enabled, true),
not(isNull(resources.domainId))
)
),
inArray(redirectHost, candidates)
)
)