400 Bad Request – request header or cookie too large

I was getting this error on heavy usage Cookie App in nginx, so looking at nginx documation, found the solution

Terminal

you can go global or site specific, because large_client_header_buffers. it’s only valid in http or server contexts,

so for only site specific I went server way

sudo nano /etc/nginx/sites-enabled/yoursite.com

Add this line on your server context

large_client_header_buffers 4 16k;

you can play with size of the client buffer, I need only 4 16k , default isĀ  4 8k

restart nginx and test

sudo service nginx restart