fix(domains): improve shared Nginx reconciliation logic in domain routes

This commit is contained in:
KodekaTeam committed 2026-08-22 00:56:24 +07:00
1 parent f38f8f16d3
commit e097467c95
2 files changed
+14 -2

No files matched your search

+7
View File
@@ -41,6 +41,13 @@ const securityHeaders = [
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
allowedDevOrigins: ["localhost", "127.0.0.1", "192.168.12.11"], allowedDevOrigins: ["localhost", "127.0.0.1", "192.168.12.11"],
devIndicators: false, devIndicators: false,
experimental: {
// Domain provisioning can include SSH, Nginx validation/reload, and
// Certbot work. Keep the same-origin rewrite alive long enough for the
// backend to return its structured result instead of a proxy-generated
// non-JSON 500 response.
proxyTimeout: 5 * 60 * 1000,
},
async rewrites() { async rewrites() {
const backendUrl = const backendUrl =
process.env.INTERNAL_API_URL || process.env.INTERNAL_API_URL ||
+7 -2
View File
@@ -1837,8 +1837,13 @@ export async function domainRoutes(app: FastifyInstance) {
const willBeSharedNginx = isSharedNginxConfig(nextInput); const willBeSharedNginx = isSharedNginxConfig(nextInput);
const previousRootDomain = getDomainConfigAnchor([existing.name]); const previousRootDomain = getDomainConfigAnchor([existing.name]);
const nextRootDomain = getDomainConfigAnchor([nextInput.name]); const nextRootDomain = getDomainConfigAnchor([nextInput.name]);
const previousSharedGroupNames = const shouldReconcilePreviousShared =
wasSharedNginx && wasSharedNginx &&
(!willBeSharedNginx ||
existing.serverId !== (nextInput.serverId ?? null) ||
previousRootDomain !== nextRootDomain);
const previousSharedGroupNames =
shouldReconcilePreviousShared &&
existing.serverId && existing.serverId &&
existing.targetContainerId && existing.targetContainerId &&
existing.targetPort existing.targetPort
@@ -1938,7 +1943,7 @@ export async function domainRoutes(app: FastifyInstance) {
}); });
if ( if (
wasSharedNginx && shouldReconcilePreviousShared &&
existing.serverId && existing.serverId &&
existing.targetContainerId && existing.targetContainerId &&
existing.targetPort existing.targetPort