From d2aed579f7b60ee0b92c6f3deace4dfdef05e0ce Mon Sep 17 00:00:00 2001 From: marvin Date: Sat, 12 Sep 2026 22:45:21 -0400 Subject: [PATCH] Trigger an immediate upstream health check when a proxy host's PATCH settings change --- package.json | 2 +- src/server.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2b78622..bf43d1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "site-gateway", - "version": "0.11.33", + "version": "0.11.34", "private": true, "description": "Site Gateway: simple self-hosted website publishing, reverse proxying, and automatic HTTPS.", "type": "module", diff --git a/src/server.js b/src/server.js index 6080743..6a7af40 100644 --- a/src/server.js +++ b/src/server.js @@ -1277,6 +1277,10 @@ app.patch("/api/proxies/:id", async (req, res, next) => { if (req.body.tls !== undefined) proxy.tls = req.body.tls === "custom" && proxy.certificatePath && proxy.keyPath ? "custom" : ["http", "automatic", "internal"].includes(req.body.tls) ? req.body.tls : proxy.tls; if (req.body.hsts !== undefined) proxy.hsts = req.body.hsts === true; applyAdvancedSettings(proxy, req.body); + // Mirror the Hosted Site PATCH handler: react immediately instead of waiting on the 60s + // background checkAllProxies() timer or a page refresh to pick up a Monitor toggle/edit. + if (proxy.healthEnabled === false) upstreamHealth.set(proxy.id, { status: "unmonitored", checkedAt: null, history: [] }); + else { upstreamHealth.set(proxy.id, { status: "pending", checkedAt: null, history: [] }); checkProxy(proxy).catch(error => console.warn("Proxy health check failed:", error.message)); } await syncCaddy(); await pruneOrphanedCertificates(previousDomains); await saveProxies();