From 4007c6c6e8d421b155af4cf2adc32f394c46aebf Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 19 Jun 2024 12:00:48 -0700 Subject: [PATCH] add health/readiness OPTIONS --- .../health_endpoints/_health_endpoints.py | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.py index c4dec65dbf..8c3af27f32 100644 --- a/litellm/proxy/health_endpoints/_health_endpoints.py +++ b/litellm/proxy/health_endpoints/_health_endpoints.py @@ -405,11 +405,6 @@ async def active_callbacks(): tags=["health"], dependencies=[Depends(user_api_key_auth)], ) -@router.options( - "/health/readiness", - tags=["health"], - dependencies=[Depends(user_api_key_auth)], -) async def health_readiness(): """ Unprotected endpoint for checking if worker can receive requests @@ -477,3 +472,20 @@ async def health_liveliness(): Unprotected endpoint for checking if worker is alive """ return "I'm alive!" + + +@router.options( + "/health/readiness", + tags=["health"], + dependencies=[Depends(user_api_key_auth)], +) +async def health_readiness_options(): + """ + Options endpoint for health/readiness check. + """ + response_headers = { + "Allow": "GET, OPTIONS", + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Headers": "*", + } + return {"headers": response_headers}