When too much HTTP header data is sent back during an HTTP response, these can be logged as a successful response on the Web (Apache/PHP) layer (showing a "200" status code on access.log), but trigger a 503 sent back to the browser/client.
An example of an HTML header response that has the potential to be too large could be the following,
$ curl -sLIXGET http://www.examplesite.com .. // more links Link: ; rel="alternate"; hreflang="en" Link: ; rel="alternate"; hreflang="it" Link: ; rel="alternate"; hreflang="ar" Link: ; rel="alternate"; hreflang="bg" Link: ; rel="alternate"; hreflang="zh-hans" Link: ; rel="alternate"; hreflang="zh-hant" Link: ; rel="alternate"; hreflang="hr" .. // more links X-UA-Compatible: IE=edge Content-language: en X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN Expires: Sun, 19 Nov 1978 05:00:00 GMT Vary: Accept-Encoding X-Generator: Drupal 8 (https://www.drupal.org) X-Request-ID: v-613c0d9a-4caf-11ea-bd62-8b9906c0bc78 X-AH-Environment: dev Age: 0 Via: varnish X-Cache: MISS Accept-Ranges: bytes Content-Length: 23005 Connection: keep-alive
Since there is a hard limit in Acquia Cloud around the size and number of headers a response can have, you must reduce the amount of headers and/or data by:
- Disabling some modules
- Limiting the data using a special custom module
Common cause: the D8 Core Content Translation module
A common issue is triggered by the Content Translation code module adding many "Link" headers on a response. The Content Translation module exposes link relations both at the HTTP level (Link response header) and the HTML level (<link> tag in HTML <head>). This can easily exceed the number of allowable headers. The particular Link headers are generated because of this code within content_translation_page_attachments():
$page['#attached']['html_head_link'] = [ [ 'rel' => 'alternate', 'hreflang' => $language->getId(), 'href' => $url, ], TRUE, ];
To alter the module behavior so that it no longer adds a Link response header, create a custom module and implement hook_page_attachments_alter() to set the boolean to FALSE for all html_head_link elements.
On Acquia Cloud, the soft limit is 60 individual headers and/or a combined total of 23kb of header data. Requests which exceed the soft limit may serve 503 status codes from Varnish and 200 from the Apache backend.
Drupal 8 and certain contributed modules may increase the size of headers sent out with each response, so that
We are working towards a Varnish configuration change that will remove this soft limit. In the meantime, you may need to adjust your site to emit less header data.