Skip to content

Commit 248a8a5

Browse files
committed
fix: use endswith for health probe path matching with root_path
When root_path is set (e.g. /api/lightspeed), the request path becomes /api/lightspeed/liveness instead of /liveness. The exact match fails and health probes get rejected with 401. Use endswith() to match regardless of path prefix. Signed-off-by: Major Hayden <major@redhat.com>
1 parent c5f5bfb commit 248a8a5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/authentication/rh_identity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ async def __call__(self, request: Request) -> AuthTuple:
217217
identity_header = request.headers.get("x-rh-identity")
218218
if not identity_header:
219219
# Skip auth for health probes when configured
220-
if request.url.path in ("/readiness", "/liveness"):
220+
if request.url.path.endswith(("/readiness", "/liveness")):
221221
if configuration.authentication_configuration.skip_for_health_probes:
222222
return NO_AUTH_TUPLE
223223
logger.warning("Missing x-rh-identity header")

0 commit comments

Comments
 (0)