how to fix upstream sent too big header while reading response header from upstream?

前端 未结 2 884
野性不改
野性不改 2021-01-18 14:32

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           


        
2条回答
  •  耶瑟儿~
    2021-01-18 15:33

    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"

    1. Your upstream server thread crashed
    2. The upstream server sent an invalid header back
    3. The Notice/Warnings sent back from STDERR broke their buffer and both it and STDOUT were closed

    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:

    2015/11/23 10:30:02 [error] 32451#0: *580927 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined index: Firstname in /srv/www/classes/data_convert.php on line 1090
    PHP message: PHP Notice:  Undefined index: Lastname in /srv/www/classes/data_convert.php on line 1090
    ... // 20 lines of same
    PHP message: PHP Notice:  Undefined index: Firstname in /srv/www/classes/data_convert.php on line 1090
    PHP message: PHP Notice:  Undefined index: Lastname in /srv/www/classes/data_convert.php on line 1090
    PHP message: PHP Notice:
    2015/11/23 10:30:02 [error] 32451#0: *580927 FastCGI sent in stderr: "ta_convert.php on line 1090
    PHP message: PHP Notice:  Undefined index: Firstname
    

    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.

提交回复
热议问题