From ea4adfa335208fca4690dc8083d10ee5f6cbdcee Mon Sep 17 00:00:00 2001 From: Brian Turek <2017685+Caligatio@users.noreply.github.com> Date: Mon, 11 Nov 2024 17:58:12 +0100 Subject: [PATCH] fix: Add support for HTTPS in healthcheck (#4538) --- mealie/scripts/healthcheck.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mealie/scripts/healthcheck.py b/mealie/scripts/healthcheck.py index 135daeb66..40b04c5ca 100644 --- a/mealie/scripts/healthcheck.py +++ b/mealie/scripts/healthcheck.py @@ -10,9 +10,15 @@ def main(): if port is None: port = 9000 - url = f"http://127.0.0.1:{port}/api/app/about" + if all(os.getenv(x) for x in ["TLS_CERTIFICATE_PATH", "TLS_PRIVATE_KEY_PATH"]): + proto = "https" + else: + proto = "http" - r = requests.get(url) + url = f"{proto}://127.0.0.1:{port}/api/app/about" + + # TLS certificate is likely not issued for 127.0.0.1 so don't verify + r = requests.get(url, verify=False) if r.status_code == 200: sys.exit(0)