commit a7c8e864c8d5f8c295e6bf806e449ad390bf33b9
parent 36c31c229c4bd422590d9b6a83a7d38a3a7f662b
Author: AMIT DUTTA <amitdutta4255@gmail.com>
Date: Sat, 10 Jan 2026 20:50:40 +0530
Enhance health check handler for multiple paths
Updated health check to respond to both '/' and '/healthz' endpoints.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/backend.py b/backend.py
@@ -177,7 +177,9 @@ async def health_check(path, request_headers):
Custom handler to intercept HTTP requests (like health checks)
before the WebSocket handshake.
"""
- if path == "/healthz":
+ # Render sends HTTP HEAD or GET requests to '/' or '/healthz' for health checks.
+ # We must return a valid HTTP response to prevent the server from treating it as a failed handshake.
+ if path == "/" or path == "/healthz":
return http.HTTPStatus.OK, [], b"OK"
# Returning None tells websockets to proceed with the standard handshake
return None