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

**URL:** <https://forum.keycloak.org/t/bad-gateway-error-502-with-firefox-when-authenticating-chromium-based-browsers-work/19575>\
**Category:** Securing applications\
**Created:** [January 12, 2023, 9:41am UTC](https://forum.keycloak.org/t/bad-gateway-error-502-with-firefox-when-authenticating-chromium-based-browsers-work/19575 "2023-01-12T09:41:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomz](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tomz/32/6499_2.png) [@tomz](https://forum.keycloak.org/u/tomz)\
**Post date:** [January 12, 2023, 9:41am UTC](https://forum.keycloak.org/t/bad-gateway-error-502-with-firefox-when-authenticating-chromium-based-browsers-work/19575/1 "2023-01-12T09:41:18Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![adropofliquid](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/adropofliquid/32/6859_2.png) [@adropofliquid](https://forum.keycloak.org/u/adropofliquid)\
**Post date:** [February 24, 2023, 9:06pm UTC](https://forum.keycloak.org/t/bad-gateway-error-502-with-firefox-when-authenticating-chromium-based-browsers-work/19575/2 "2023-02-24T21:06:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tomz](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tomz/32/6499_2.png) [@tomz](https://forum.keycloak.org/u/tomz)\
**Post date:** [February 25, 2023, 9:44am UTC](https://forum.keycloak.org/t/bad-gateway-error-502-with-firefox-when-authenticating-chromium-based-browsers-work/19575/3 "2023-02-25T09:44:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adropofliquid](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/adropofliquid/32/6859_2.png) [@adropofliquid](https://forum.keycloak.org/u/adropofliquid)\
**Post date:** [February 27, 2023, 6:38pm UTC](https://forum.keycloak.org/t/bad-gateway-error-502-with-firefox-when-authenticating-chromium-based-browsers-work/19575/4 "2023-02-27T18:38:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![adropofliquid](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/adropofliquid/32/6859_2.png) [@adropofliquid](https://forum.keycloak.org/u/adropofliquid)\
**Post date:** [March 9, 2023, 3:03pm UTC](https://forum.keycloak.org/t/bad-gateway-error-502-with-firefox-when-authenticating-chromium-based-browsers-work/19575/5 "2023-03-09T15:03:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tomz](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tomz/32/6499_2.png) [@tomz](https://forum.keycloak.org/u/tomz)\
**Post date:** [March 9, 2023, 3:54pm UTC](https://forum.keycloak.org/t/bad-gateway-error-502-with-firefox-when-authenticating-chromium-based-browsers-work/19575/6 "2023-03-09T15:54:34Z")

</div>

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!
