Magento2: upstream sent too big header while reading response header from upstream

Created on 26 Jun 2017  路  7Comments  路  Source: magento/magento2


Magento set message into the cookie "mage-messages", but nobody removes them. After a while,
the cookie will grow so long that exceeds the cookie limit.

Preconditions


  1. Magento 2.1.2

Steps to reproduce

  1. login as a customer
  2. make 30 orders
  3. you will find error message:
    502 Bad Gateway
    nginx/1.8.0
  4. in nginx error.log, you will find
    2017/06/26 12:19:15 [error] 5520#7632: *1 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: www.magento21.local, request: "POST /index.php/checkout/cart/add/uenc/aHR0cDovL3d3dy5tYWdlbnRvMjEubG9jYWwvaW5kZXgucGhwL2FmNjQtMjAxOS1iaWxsZXQtdGltaW5nLWNvdmVyLWZvcmQtMzUxYy1ibHVlLmh0bWw,/product/1/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "www.magento21.local", referrer: "http://www.magento21.local/index.php/af64-2019-billet-timing-cover-ford-351c-blue.html"

Expected result

  1. clean message stored in cookie promptly, there should be no errors.

Actual result

  1. [Screenshot, logs]
    502 Bad Gateway
    nginx/1.8.0
Cannot Reproduce Clear Description Format is valid bug report

Most helpful comment

for those who found this page with this issue.
I fixed this problem by adding this configuration to /etc/nginx/nginx.conf:

http {
  .... your config ...

  fastcgi_buffers 16 16k;
  fastcgi_buffer_size 32k;
}

(from stack overflow)

All 7 comments

@dbsdsun, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.3.0, 2.2.0, 2.1.9

@magento-engcom-team I had this problem recently

mage-messages is to big to fit to the default nginx settings, provided in this repository

Headers buffer full, so

add the following lines
to the nginx config (server area)

proxy_buffer_size   128k;
proxy_buffers   4 256k;
proxy_busy_buffers_size   256k;

and restart nginx

the problem is Magento keeping adding cookie without removing old ones in my experience.
Therefore, adjusting nginx is not a solution.

for those who found this page with this issue.
I fixed this problem by adding this configuration to /etc/nginx/nginx.conf:

http {
  .... your config ...

  fastcgi_buffers 16 16k;
  fastcgi_buffer_size 32k;
}

(from stack overflow)

for those who found this page with this issue.
I fixed this problem by adding this configuration to /etc/nginx/nginx.conf:

http {
  .... your config ...

  fastcgi_buffers 16 16k;
  fastcgi_buffer_size 32k;
}

(from stack overflow)

This works for me as well. Thanks for solution!

for those who found this page with this issue.
I fixed this problem by adding this configuration to /etc/nginx/nginx.conf:

http {
  .... your config ...

  fastcgi_buffers 16 16k;
  fastcgi_buffer_size 32k;
}

(from stack overflow)

This works for me as well. Thanks for solution!

Works for me - a lot of crying before I found this solution.

Was this page helpful?
0 / 5 - 0 ratings