diff --git a/server/model/monitor.js b/server/model/monitor.js index 55830d8f..c3bcdef0 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -541,19 +541,17 @@ class Monitor extends BeanModel { // fallback for if kelog event is not emitted, but we may still have tlsInfo, // e.g. if the connection is made through a proxy - if (this.getUrl()?.protocol === "https:") { - if (tlsInfo.valid === undefined) { - const tlsSocket = res.request.res.socket; - - if (tlsSocket) { - tlsInfo.valid = tlsSocket.authorized || false; - tlsInfo = checkCertificate(tlsSocket); - await this.updateTlsInfo(tlsInfo); - - if (!this.getIgnoreTls() && this.isEnabledExpiryNotification()) { - log.debug("monitor", `[${this.name}] call checkCertExpiryNotifications`); - await this.checkCertExpiryNotifications(tlsInfo); - } + if (this.getUrl()?.protocol === "https:" && tlsInfo.valid === undefined) { + const tlsSocket = res.request.res.socket; + + if (tlsSocket) { + tlsInfo.valid = tlsSocket.authorized || false; + tlsInfo = checkCertificate(tlsSocket); + await this.updateTlsInfo(tlsInfo); + + if (!this.getIgnoreTls() && this.isEnabledExpiryNotification()) { + log.debug("monitor", `[${this.name}] call checkCertExpiryNotifications`); + await this.checkCertExpiryNotifications(tlsInfo); } } }