Drupal 8 and HTTP/2 Server Push

Submitted by dryer on Thu, 11/12/2015 - 18:07
HTTP/2 logo

Around the time of the release of Drupal 8 there is a more significant, but subtle evolution taking over the web. This is HTTP/2, a new and improved version of the venerable protocol powering not only web sites and applications but a lot of infrastructure messaging for energy, industry and more.

Drupal 8 comes with a wrath of impressive technical improvements for the low level HTTP communications and they're all compatible withHTTP/2 because of how the protocol is designed to work. The HTTP version in use is not dependent on any server side programming language of application like Drupal and will improve performance simply by enabling the new protocol

However, Big Pipe and other technologies in Drupal 8 can be improved to take further advantage from HTTP/2. One of these is the introduction of Server Push in HTTP/2. Traditionally the browser has sent requests for each resource (image, stylesheets, javascript) and the server has responded with these. With Server Push the server can send data without the conscent of the browser, for example critical render blocking stylesheets can be sent along with the first response to allow quick rendering.

Drupal 8 uses the Symfony HttpKernel component for all communications and it should be feasible to attach a mechanism to this in the future. Implementing HTTP/2 server push in PHP is rather simple by just sending a few headers, but it's good to have a standard way of doing this.

A wrapper to the implementation discussed in this could be a good way of implementing this feature in Drupal: Implementing HTTP/2 Server Push in PHP with the HttpKernel