# Got "502 Bad Gateway" on login callback when using NGINX reverse proxy

**URL:** <https://community.auth0.com/t/got-502-bad-gateway-on-login-callback-when-using-nginx-reverse-proxy/116896>\
**Category:** Get Help\
**Tags:** oidc, protocols\
**Created:** [September 21, 2023, 11:25pm UTC](https://community.auth0.com/t/got-502-bad-gateway-on-login-callback-when-using-nginx-reverse-proxy/116896 "2023-09-21T23:25:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![michael.samorokov](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@michael.samorokov](https://community.auth0.com/u/michael.samorokov)\
**Post date:** [September 21, 2023, 11:48pm UTC](https://community.auth0.com/t/got-502-bad-gateway-on-login-callback-when-using-nginx-reverse-proxy/116896/2 "2023-09-21T23:48:05Z")

</div>

Ok, I’ve figured it out.  
Here is what I found in Nginx logs:

`2023/09/21 23:35:10 [error] 2659942#2659942: *522258 upstream sent too big header while reading response header from upstream, client: 192.168.168.1, server: my.hostname, request: "POST /callback HTTP/2.0", upstream: "https://192.168.168.135:7176/callback", host: "my.hostname", referrer: "https://my-domain.us.auth0.com/"`

So it works fine after adding this buffer config to Nginx:

```auto
server {
 proxy_busy_buffers_size 512k;
 proxy_buffers 4 512k;
 proxy_buffer_size 256k;
 # rest of the nginx config below #
}

```

Don’t forget to bump your Nginx memory 🙂

---

_[View the full topic](https://community.auth0.com/t/got-502-bad-gateway-on-login-callback-when-using-nginx-reverse-proxy/116896)._
