Skip to main content

2 posts tagged with "ops"

View All Tags

Keycloak email not sending: SMTP debugging

· 9 min read
Jeff Patzer
Phase Two

When Keycloak email is not sending, the one thing you cannot use as evidence is the screen. The forgot-password page prints "You should receive an email shortly with further instructions" whether the message was delivered, the relay rejected the credentials, or the realm has no SMTP server configured at all. So the diagnosis never starts with the user's report. It starts in three places, in this order: the realm's events tell you whether Keycloak tried, the Caused by: chain in the server log tells you which phase failed, and the first line of the EmailException tells you whether you are looking at a connection problem, an authentication problem or a rejected message.

Everything below was reproduced on Keycloak 26.8.2 in a container, against a real SMTP server with plaintext, STARTTLS, implicit TLS and SMTP AUTH. Every error string, log line and timing is copied from a run on 2026-11-23.

Keycloak 502 Bad Gateway behind a reverse proxy

· 8 min read
GR Patil
Phase Two

A Keycloak 502 Bad Gateway never comes from Keycloak. RFC 9110 defines 502 as a status a gateway emits about its upstream — so the proxy is telling you it could not get a usable response out of Keycloak, and the explanation is in the proxy's error log rather than anywhere in Keycloak's configuration. Start there, every time. In nginx there are only six lines that produce a 502 in front of Keycloak, each maps to one cause, and three of the six are the Quarkus-era port layout catching out a config written for an older release.

Everything below was reproduced against Keycloak 26.8.1 behind nginx 1.29, and every error string is copied out of a real run.