I have this error in my log :
upstream sent too big header while reading response header from upstream
And I tried to add
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
to my nginx.conf http block but did not work
I also tried to add
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
to my conf file but I could not locate any location ~ .php$ {
So I wonder how I can over come this error ? adding
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
to a hand made php block gives me nginx: [emerg] unknown directive "location" in /etc/nginx/nginx.conf:6
upstream sent too big header while reading response header from upstream
is nginx's generic way of saying "I don't like what I'm seeing"3: Look at the error logs above the message, is it streaming with logged lines preceding the message?
PHP message: PHP Notice: Undefined index:
Example snippet from a loop my log file:you can see in the 3rd line (from the 20 previous errors) the buffer limit was hit, broke, and the next thread wrote in over it. Nginx then closed the connection and returned 502 to the client.
2: log all the headers sent per request, review them and make sure they conform to standards (nginx does not permit anything older than 24 hours to delete/expire a cookie, sending invalid content length because error messages were buffered before the content counted...)
examples include:
and this:
1: verify, or make a script log, to ensure your thread is reaching the correct end point and not exiting before completion.
Usually this parameters fix "upstream sent too big header" issue, and you dont need huge values for them :) And set them for http or server blocks, not location.
Also sometimes FirePHP for Firefox creates large headers, try to disable it temporarily.