Friday, 12 May 2017

Node/NGINX 400 Request Header Or Cookie Too Large

Problem

I am attempting to send a request to a remote nginx (1.10.0) / node (4.2.6) server running on ubuntu (14.04) linux. It works normally most of the time, but if a header is large in size, the request fails with the following error..

< html > < head > < title > 400 Request Header Or Cookie Too Large < /title></head > < body bgcolor = "white" > < center > < h1 > 400 Bad Request < /h1></center > < center > Request Header Or Cookie Too Large < /center></body > < /html>

My test header size is 8,260 bytes and is comprised of comma separated IDs, like below...

4322,6543,4756352,745635,7456,7546345,2343

Attempted Fixes

I have added the following to my nginx config (as per many suggestions on google and stack overflow) and nothing has fixed it...

large_client_header_buffers 4 32k;
client_body_buffer_size 32K;
client_header_buffer_size 32k;
client_max_body_size 20M;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
proxy_buffer_size   128k;
proxy_buffers   4 256k;
proxy_busy_buffers_size   256k;
proxy_connect_timeout       60;
proxy_read_timeout          120;

Any ideas welcome.



via SamuraiSteve

No comments:

Post a Comment