Skip to content

Registry: UI Logout function does not redirect correctly when using routingMode = path #500

@snorlaX-sleeps

Description

@snorlaX-sleeps

Related issue: #390
PR adding path based routing to the Helm Chart: #395

Issue

When the routing mode is set to path the registry logout function uses the host header to determine the redirect_uri that is passed to both the auth-server and keycloak.
This should be updated to include the root_path when it is set
Registry Logout function using the host header: https://github.com/agentic-community/mcp-gateway-registry/blob/main/registry/auth/routes.py#L238
Both the auth-server and keycloak use the redirect_uri from the registry.

Example logs from logout attempt

Removing the host but leaving the root_path in the logs

Registry

registry-7c5bc5b86c-vzd4g registry 2026-02-17 19:56:46,558,p114,{routes.py:223},INFO,User was authenticated via OAuth2 provider: keycloak
registry-7c5bc5b86c-vzd4g registry 2026-02-17 19:56:46,558,p114,{routes.py:254},INFO,Redirecting to keycloak logout: https://<host>/auth-server/oauth2/logout/keycloak?redirect_uri=https://<host>/logout
registry-7c5bc5b86c-vzd4g registry 2026-02-17 19:56:46,558,p114,{routes.py:258},INFO,User logged out.

Auth Server

auth-server-66f6c4f5c7-z7gms auth-server 2026-02-17 19:09:56,496,p1,{server.py:2781},INFO,Redirecting to keycloak logout: https://<host>/keycloak/realms/mcp-gateway/protocol/openid-connect/logout?client_id=mcp-gateway-web&post_logout_redirect_uri=https%3A%2F%2F<host>%2Flogout
auth-server-66f6c4f5c7-z7gms auth-server INFO:     10.0.38.254:47363 - "GET /auth-server/oauth2/logout/keycloak?redirect_uri=https://<host>/logout HTTP/1.1" 302 Found

KeyCloak

mcp-gateway-registry-keycloak-0 keycloak 2026-02-17 19:56:46,802 WARN  [org.keycloak.events] (executor-thread-22) type="LOGOUT_ERROR", realmId="fe28af42-fd6c-4aee-921d-8d893a7666b9", realmName="mcp-gateway", clientId="mcp-gateway-web", userId="null", ipAddress="ip", error="invalid_redirect_uri", redirect_uri="https://<host>/logout"

This is not the same issue as #490 but they are both happening when trying to change users

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions