From f137a81da580c9e07f8a18e94870e6181bfb2d90 Mon Sep 17 00:00:00 2001 From: adman234 Date: Mon, 16 Nov 2026 08:48:08 -0600 Subject: [PATCH] 404 hosts: save cleaned SSL/HSTS values when attaching a new certificate --- backend/internal/dead-host.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/backend/internal/dead-host.js b/backend/internal/dead-host.js index 2d3e9760a..ea2186ad4 100644 --- a/backend/internal/dead-host.js +++ b/backend/internal/dead-host.js @@ -76,16 +76,24 @@ const internalDeadHost = { const cert = await internalCertificate.createQuickCertificate(access, data); // Update host with cert id and re-apply the originally submitted - // SSL toggles, now that a real certificate exists for them to - // validate against. - await internalDeadHost.update(access, { - id: row.id, + // SSL toggles, cleaned now that a real certificate exists for them + // to validate against. update() saves the values it is given, so + // they have to be cleaned here (e.g. HSTS off when Force SSL is off). + const sslData = internalHost.cleanSslHstsData({ certificate_id: cert.id, ssl_forced: thisData.ssl_forced, http2_support: thisData.http2_support, hsts_enabled: thisData.hsts_enabled, hsts_subdomains: thisData.hsts_subdomains, }); + await internalDeadHost.update(access, { + id: row.id, + certificate_id: cert.id, + ssl_forced: sslData.ssl_forced, + http2_support: sslData.http2_support, + hsts_enabled: sslData.hsts_enabled, + hsts_subdomains: sslData.hsts_subdomains, + }); } // re-fetch with cert