How to avoid "too big header" issue?

stalkercn nginx-forum at nginx.us
Thu Apr 21 15:02:27 MSD 2011


There's hundreds of "setcookie('xxx','yyy')" lines in one of my php
page,the size of these cookies is about 2-10KB,so nginx always throw a
typical "502 bad gateway".

my solutionA is: add this to nginx.conf:

client_header_buffer_size 8m;
large_client_header_buffers 8 8m;
fastcgi_buffer_size 8m;
fastcgi_buffers 8 8m;

result:no effect. I tried increasing the size from 8m to 128m,but it
still give me a 502 errror.


and solution B:

fastcgi_ignore_headers Set-Cookie;

result:no effect. In error log,there's still a large amount of
'Set-Cookie' header info:

2011/04/21 18:28:10 [debug] 66257#0: *2 http fastcgi header:
"Set-Cookie: xxx=yyy; expires=Wed, 21-Apr-2010 10:28:09 GMT"
............
............
2011/04/21 18:28:10 [debug] 66257#0: *2 http fastcgi parser: -2
2011/04/21 18:28:10 [debug] 66257#0: *2 upstream split a header line in
FastCGI records
2011/04/21 18:28:10 [error] 66257#0: *2 upstream sent too big header
while reading response header from upstream..........

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,192785,192785#msg-192785




More information about the nginx mailing list