Error 502 upstream sent too big header

Source: Internet
Author: User

Nginx Log error 502 upstream sent too big header while reading response headers from upstream

The value of the cookie is out of range I mean,

Look at the log.

Error 502 upstream sent too big header while reading response headers from upstream

sudo gedit/var/log/nginx/error.log

Viewing the error log

Upstream sent too big header while reading response headers from upstream

You go to search this error, the online explanation is similar, no outside of the cookie is carrying the header too much, let you set:

Fastcgi_buffer_size 128k;
Fastcgi_buffers 8 128k;

Gradually try. Which fastcgi_buffers 8 128k This sentence, fastcgi_buffers 32k such a better, memory is the whole block allocation and release, reduce the number of K can be used as far as possible.

In addition, if you do load balancing with nginx, changing the above parameters is useless, in the forwarding configuration, such as the following settings:

Location @to_other {

Proxy_buffer_size 128k;

Proxy_buffers 32k;

Proxy_busy_buffers_size 128k;

Add_header x-static transfer;

Proxy_redirect off;

Proxy_set_header Host $host;

Proxy_set_header X-real-ip $remote _addr;

Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;

Proxy_pass Http://backend; #请求转发

}

The bold three lines will not work.

Fastcgi_* can be understood to be used when Nginx accepts a response from a client request. Proxy is used when nginx as a client forwarding, if the header is too large, beyond the default of 1k, it will trigger the above upstream sent too big header.

can refer to:

Http://wiki.nginx.org/NginxHttpProxyModule

Http://blog.sina.com.cn/s/blog_5dc960cd0100i4mt.html

Other search results can be ignored and are very similar.

Location ~ \.php$ {

Fastcgi_buffer_size 128k;

Fastcgi_buffers 32k;

Include/etc/nginx/fastcgi_params;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param script_filename/host/web/$fastcgi _script_name;

}

Error 502 upstream sent too big header

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.