Trigger an immediate upstream health check when a proxy host's PATCH settings change

This commit is contained in:
marvin
2026-09-12 22:45:21 -04:00
parent 4a9cba5f8e
commit d2aed579f7
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -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",
+4
View File
@@ -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();