Skip to content

X-Magento-Tags Header too long - Apache / PHP error 500 on category pages #26960

Closed
@marvinhinz

Description

@marvinhinz

Preconditions (*)

  1. Latest Magento 2.3.4 (Developer Mode)
  2. A category containing many (simple) products (in this case about 2600)
  3. No Varnish
  4. Apache + PHP7.3-FPM (happens with 7.2 too)

Steps to reproduce (*)

It seems magento creates http headers that are too long for most or some apache configurations. For me it happens when visiting a category page with many products.

PHP error log:

[Fri Feb 21 09:20:55.678915 2020] [proxy_fcgi:error] [pid 13470:tid 140320488904448] [client XXXXX:53641] Premature end of script headers: index.php, referer: https://XXXXX/shop/catalog/category/view/id/3
[Fri Feb 21 09:20:55.678978 2020] [proxy_fcgi:error] [pid 13470:tid 140320488904448] [client XXXXX:53641] AH01070: Error parsing script headers, referer: https://XXXXX/shop/catalog/category/view/id/3
[Fri Feb 21 09:20:55.678984 2020] [proxy_fcgi:error] [pid 13470:tid 140320488904448] (22)Invalid argument: [client XXXXX:53641] AH01075: Error dispatching request to : , referer: https://XXXXX...

Expected result (*)

I can understand that these headers are important for caching, and the HTTP spec doesnt define a limit for header sizes.
But most servers do in fact implement a limit (around ~8k), so i think this is a bug that should be fixed. https://stackoverflow.com/questions/686217/maximum-on-http-header-values

Actual result (*)

In my specific case, the http response is cached by magento FPC, and returned to the client in:
magento/vendor/magento/framework/App/Http.php:122

The X-Magento-Tags heade size is 27kB. The content is made up of strings like this one: cat_p_2611,cat_p,cat_p_2584,cat_p_2585.

If i add the following in the row after, the page works again:
$this->_response->setHeader('X-Magento-Tags', "test");

Metadata

Metadata

Assignees

Labels

Issue: needs updateAdditional information is require, waiting for responseReported on 2.3.4Indicates original Magento version for the Issue report.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions