I have found the solution. The problem was that there were multiple instances of nginx running. This was causing a conflict and that’s why the large_client_header_buffers wasnt working. After killing all nginx instances I restarted nginx with the configuration:
client_header_buffer_size 64k;
large_client_header_buffers 4 64k;
Everything started working after that.
Hope this helps anyone facing this problem.