Maximum value for nginx proxy_buffer

I am getting 502 bad gateway issue, while trying to login.
In nginx ingress "proxy_buffer_size" is set to 256k.
I would appreciate if you can guide me what is the max value i can set in ingress to resolve 502 bad gateway issue

keycloack: 16
k8s: 1.20