Bad gateway error, 502 with Firefox when authenticating. Chromium based browsers work

For a while I am getting more and more reports from users which are receiving an err 502 when trying to logon to a service. And things got worse when upgrading to v20.0.2
And in the logs there is the infamous “Nginx upstream sent too big header while reading response header from upstream” which I found here and all over the internet.
The proposed solution is always to increase the nginx buffer sizes in the http section of the nginx / keycloak settings, like so:

proxy_busy_buffers_size 512k;
proxy_buffers 4 512k;
proxy_buffer_size 256k;

Unfortunately, this doesn’t work for me, I increased the values step by step until nginx wouldn’t start any more, but the error won’t go away.
And what’s even more strange is that users with Chromium based browsers don’t have any issues whereas Firefox rather reliably is unable to connect.

My laymans conclusion is therefore that my error has got nothing to do with the buffers, it just happens to lead to the same error message?
Anyone got an idea as to how to tackle this?

1 Like

I am having the same problem as well. It started when I upgraded to v20. Have you found a solution to this?

It does work on firefox when I clear the cookies/cache of my website from the firefox and reload. but this happens again when I come back say 24hours later

Unfortunately no, my “workaround” right now is to not upgrade Keycloak.
What I did notice though is that this does only seem to happen when a user tries to reconnect to an existing session.
Means, the initial logon works fine, but when one comes back to a page after some time and the session is checked again (?) this error happens.

Thanks for your response. I will come back to this place if I find any fix anywhere

After upgrading to v21.0.1. The issues seems to have stopped. Everything works fine for now

Cool! I upgraded one instance right away. I will give it a few days before coming back here confirming it’s working for me as well.

Thanks for posting your update!

1 Like