Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 301110

With many languages, content_translation_page_attachments adds too many alternate links to the response headers crashing varnish (503)

$
0
0

Problem/Motivation

content_translation_page_attachments() adds alternate links to the html head. However these links also end up in the response headers. The large header size crashes the webserver.

The HTTP Link entity-header field provides a means for serializing one or more links in HTTP headers. It is semantically equivalent to the HTML
element.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link

The first bytes in a response are important from a performance perspective. Link response headers are semantically equivalent to the HTML <link> element, so these links should not be available in both the response headers and HTML <link> elements

Proposed resolution

Remove rel="alternate" links from the response headers.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

rel="alternate" links provided by the Content Translation module were added as both link HTTP headers and link HTML tags, but are now added only as link HTML tags.

Original report by swentel

content_translation_page_attachments() adds alternate links to the html head, which is fine. However these links also end up in the response headers (I honestly don't really understand why we do that). Now, when there are too many languages (in our case, we're working with 47), varnish will crash with a 503.

-   BogoHeader     Too many headers: Vary: Accept-Encodin
-   HttpGarbage    "HTTP/1.1%00200%00OK%00%0aDate: Fri, 28 Apr 2017 12:54:20 GMT%00%0aServer: Apache/2.4.12 (Ubuntu)%00%0aX-Powered-By: PHP/5.6.20%00%0aCache-Control: must-revalidate, no-cache, private%00%0aLink: <http://127.0.0.1:6081/en/handbook>; rel="alternate"; hreflang="en"%00%0aLink: <http://12%00"
-   BerespStatus   503
-   BerespReason   Service Unavailable
-   FetchError     http format error
-   BackendClose   17 default(127.0.0.1,,80)
-   Timestamp      Beresp: 1493384064.185137 3.703384 3.703163
-   Timestamp      Error: 1493384064.185146 3.703393 0.000010
-   BerespProtocol HTTP/1.1
-   BerespStatus   503

I've altered out these alternate links for now with hook_module_implements_alter(). But we shouldn't send those to varnish IMO.

/**
 * Implements hook_module_implements_alter().
 */
function module_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'page_attachments') {
    unset($implementations['content_translation']);
  }
}

Viewing all articles
Browse latest Browse all 301110

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>