From 1f9d44d8b09c5cc87e568aaa561c98c88433d8ac Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Tue, 10 Dec 2024 14:02:05 -0800 Subject: [PATCH] fix: make healthcheck public (#2209) --- letta/server/rest_api/app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.py index ebbd5860..b48a13d0 100644 --- a/letta/server/rest_api/app.py +++ b/letta/server/rest_api/app.py @@ -109,7 +109,13 @@ random_password = os.getenv("LETTA_SERVER_PASSWORD") or generate_password() class CheckPasswordMiddleware(BaseHTTPMiddleware): + async def dispatch(self, request, call_next): + + # Exclude health check endpoint from password protection + if request.url.path == "/v1/health/" or request.url.path == "/latest/health/": + return await call_next(request) + if request.headers.get("X-BARE-PASSWORD") == f"password {random_password}": return await call_next(request)