Keycloak 502 Bad Gateway Issue Upon Angular Application Refresh or Manual URL Change After Authentication

I’m encountering difficulties while integrating Keycloak authentication into my Angular application using server configuration by creating respective realms and clients.

Issue I’m facing:

Upon launching the Angular application, it redirects to the keycloak authentication page. After signing in and navigating to the application page, the problem arises when I refresh the page or manually change the application URL. This leads to a keycloak 502 bad gateway issue. However, if I perform a hard refresh on the keycloak authentication page before signing in, everything works fine (both refreshing the page and manually changing the URL).

Please share any insights you may have on this issue or suggestions on how to overcome it.

1 Like

the same probleme with me :face_with_thermometer:

Add these directives to the http block in nginx.conf

proxy_buffer_size   128k;
proxy_buffers   4 256k;
proxy_busy_buffers_size   256k;

wich nginx keycloak or angular
and me im using k8s for the deployment ??

For those of you that are dealing with Nginx Kubernetes ingress:

"nginx.ingress.kubernetes.io/proxy-buffer-size": "128k"

More info here: Annotations - Ingress-Nginx Controller

the answer is in this post: keycloak - Why do I get 502 when trying to authenticate - Stack Overflow