Upgrade to Pro — share decks privately, control downloads, hide ads and more …

HTTP/2, PHP and Symfony: a brief history of the protocol powering the web, and how to use it

HTTP/2, PHP and Symfony: a brief history of the protocol powering the web, and how to use it

A few months ago, I’ve contributed a new component to Symfony: WebLink.
By implementing cutting edge web standards, namely HTTP/2 Server Push and W3C’s Resource Hints, it brings great opportunities to boost webapp’s performance.

Let's discover how HTTP/2 and WebLink work.

Kévin Dunglas

January 16, 2018
Tweet

More Decks by Kévin Dunglas

Other Decks in Programming

Transcript

  1. Les-Tilleuls.coop $ telnet les-tilleuls.coop 80 Connected to les-tilleuls.coop. GET /en/jobs

    <TITLE>Hello Symfony Folks</TITLE> Connection closed by foreign host.
  2. Les-Tilleuls.coop $ telnet les-tilleuls.com 80 GET /en/jobs HTTP/1.0 User-Agent: MyBrowser

    Accept: text/html HTTP/1.0 200 OK Content-Type: text/html … <h1>Hi sfPot</h1> Connection closed by foreign host.
  3. Les-Tilleuls.coop 100 <html><!--...!--> 0 GET /favicon.ico HTTP/1.1 [headers] GET /style.css

    HTTP/1.1 Connection: close [headers] HTTP/1.1 200 OK [body] HTTP/1.1 200 OK [body]
  4. Les-Tilleuls.coop 2015: HTTP/2 ❏ ❏ Binary protocol ❏ ❏ ❏

    QUIC ❏ High-level compatibility with HTTP 1 ❏
  5. Les-Tilleuls.coop h2 and PHP: Nginx server { listen 443 ssl

    http2; # ssl_certificate config # fastcgi_pass config } ❏ No Push hint support
  6. Les-Tilleuls.coop h2 and PHP: Apache Listen 443 SSLEngine on #

    SSL config Protocols h2 http/1.1 ❏ Push hint support
  7. Les-Tilleuls.coop The server or the proxy may push the linked

    resource using h2 nopush attribute: prevent h2 push but let the client send an early request.
  8. Les-Tilleuls.coop Other Built-in Twig Helpers ❏ link() ❏ preload() ❏

    dns_prefetch() ❏ preconnect() ❏ prefetch() ❏ prerender()