From 680a673a9a8f3026fb9839abfdaad4b61d84f9b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Mon, 25 May 2026 21:50:29 +0200 Subject: [PATCH] allow health without auth --- pytorrent/services/auth.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pytorrent/services/auth.py b/pytorrent/services/auth.py index 4dbeb55..c22dbd4 100644 --- a/pytorrent/services/auth.py +++ b/pytorrent/services/auth.py @@ -668,9 +668,15 @@ def install_guards(app) -> None: def _auth_guard(): if not enabled(): return None + + # Allow unauthenticated health checks for monitoring. + if request.path == "/api/health" or request.path.startswith("/api/health/"): + return None + g.api_token_authenticated = False if auth_bypassed_request(): return None + if request.path.startswith("/api/"): token_user = authenticate_api_token(_request_api_token()) if token_user: