Teleport Auth Service OIDC redirect_uri scheme mismatch behind TLS-terminating load balancer
0 reputation · 03 Sept 2024, 23:53 UTC
0 reputation · 03 Sept 2024, 23:53 UTC
When Teleport is deployed behind a load balancer that terminates TLS, the Auth Service receives OIDC callbacks on its internal HTTP endpoint while the IdP expects the redirect_uri to match the public HTTPS proxy address. Teleport 15+ documents setting auth_service.public_addr to the public HTTPS URL and forwarding X-Forwarded-Proto: https, but the behavior when this header is absent remains ambiguous.
The Auth Service currently generates redirect URIs using the scheme it observes locally. If auth_service.public_addr is configured but the load balancer does not send X-Forwarded-Proto, the callback URL incorrectly uses http://, causing the IdP to reject the request with invalid_redirect_uri. This error appears only in IdP logs, not in Teleport audit logs, making diagnosis difficult.
The documentation does not clearly state whether Teleport should trust X-Forwarded-Proto by default or require explicit proxy.trusted_xff configuration, nor does it describe a fallback when the header is missing.
auth_service.public_addr unconditionally, ignoring the incoming request scheme?proxy.trusted_xff: true with a restricted CIDR allowlist, or is there a safe default that avoids silent failures?Yes: when auth_service.public_addr is set to an https:// address, the OIDC callback URL should be built from that configured public address, not from the scheme of the incoming request. The http:// redirect_uri you are seeing is the fallback behavior: the Auth Service terminates plain HTTP internally and, with no trusted X-Forwarded-Proto header, uses the local request scheme when constructing the redirect_uri. That is the defect to eliminate, not to accommodate.
Confirmed: Okta, Auth0, Azure AD, and Keycloak all do exact string matching of redirect_uri against registered values. An http/https difference alone triggers invalid_redirect_uri, and the rejection is logged only on the IdP side — Teleport audit logs will not show it.
Likely, but verify against your version: the exact configuration key names (such as a trusted_xff-style setting) and the default header‑trust behavior vary across Teleport releases. The Teleport 15+ behavior described in your question could not be confirmed against current documentation, so check the configuration reference for your deployed version before changing keys.
auth_service.public_addr to the full public https:// address.X-Forwarded-Proto: https on every forwarded request.There is no safe default that silently tolerates a missing header; the safe posture is scheme‑correct public_addr plus a network topology where only the LB can inject forwarding headers.
redirect_uri parameter is https:// and matches the registered value character‑for‑character.X-Forwarded-Proto and confirm the generated callback URL is stable and https in both cases.One missing detail that would change this recommendation: your exact Teleport version, since the relevant key names and defaults are version‑sensitive.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.