Skip to content

Commit ea7b3da

Browse files
authored
1 parent 38fda88 commit ea7b3da

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

weblink.rst

+13-20
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,22 @@ W3C's `Resource Hints`_, the WebLink component
1010
brings great opportunities to boost webapp's performance.
1111

1212
Thanks to WebLink, HTTP/2 (**h2**) servers are able to push resources to clients
13-
before they even know that they need them (think to CSS or JavaScript
13+
before they even know that they need them (think about CSS or JavaScript
1414
files, or relations of an API resource). WebLink also enables other very
15-
efficient optimisations that work with HTTP 1:
15+
efficient optimisations that work with HTTP 1.x:
1616

1717
- telling the browser to fetch or to render another webpage in the
1818
background ;
19-
- init early DNS lookups, TCP handshakes or TLS negotiations
19+
- initializing early DNS lookups, TCP handshakes or TLS negotiations
2020

21-
Let's discover how easy it is to use it and the real life benefits you
22-
can expect.
23-
24-
To benefit from HTTP/2 Server Pushes, a HTTP/2 server and a HTTPS connection
25-
are mandatory (even in local).
21+
To benefit from HTTP/2 Server Pushes, an HTTP/2 server and an HTTPS connection
22+
are required (even local ones).
2623
Both Apache, Nginx and Caddy support these protocols.
2724
Be sure they are properly configured before reading.
2825

2926
Alternatively, you can use the `Docker installer and runtime for
3027
Symfony`_ provided by Kévin Dunglas (community supported).
3128

32-
It includes everything you need to run Symfony
33-
(PHP :doc:`configured properly for Symfony </performance>`, and Composer)
34-
as well as a development reverse proxy (Apache) supporting HTTP/2 Server Push
35-
and HTTPS (most clients only support HTTP/2 over TLS).
36-
3729
Unzip the downloaded archive, open a shell in the resulting directory and run
3830
the following command:
3931

@@ -65,7 +57,7 @@ Now, download Bootstrap_, extract the archive and copy the file
6557
``dist/css/bootstrap.min.css`` in the ``public/`` directory of our
6658
project.
6759

68-
Symfony comes with a `nice integration with of the most popular CSS framework`_.
60+
Symfony comes with a `nice integration of the most popular CSS framework`_.
6961

7062
.. note::
7163

@@ -75,8 +67,9 @@ Symfony comes with a `nice integration with of the most popular CSS framework`_.
7567

7668
Now, it's time to create the template of our homepage:
7769

78-
.. code-block:: html
70+
.. code-block:: twig
7971
72+
{# templates/homepage.html.twig #}
8073
<!DOCTYPE html>
8174
<html>
8275
<head>
@@ -104,7 +97,7 @@ And finally, register our new template as the homepage using the builtin
10497
_controller: 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction'
10598
template: 'homepage.html.twig'
10699
107-
Refresh your browser, this nice homepage should appear:
100+
Refresh your browser, this homepage should appear:
108101

109102
.. image:: /_images/components/weblink/homepage-requests.png
110103

@@ -142,21 +135,21 @@ responses have been sent directly by the server.
142135

143136
.. note::
144137

145-
Google Chrome provides a nice interface to debug HTTP/2 connections.
138+
Google Chrome provides an interface to debug HTTP/2 connections.
146139
Open ``chrome://net-internals/#http2`` to start the tool.
147140

148141
How does it works?
149142
~~~~~~~~~~~~~~~~~~
150143

151-
The WebLink component tracks Link HTTP headers to add to the response.
144+
The WebLink component tracks ``Link`` HTTP headers to add to the response.
152145
When using the ``preload()`` helper, a ``Link`` header
153146
with a `preload`_
154147
``rel`` attribute is added to the response:
155148

156149
.. image:: /_images/components/weblink/response-headers.png
157150

158151
According to `the Preload specification`_,
159-
when a HTTP/2 server detects that the original (HTTP 1) response
152+
when an HTTP/2 server detects that the original (HTTP 1.x) response
160153
contains this HTTP header, it will automatically trigger a push for the
161154
related file in the same HTTP/2 connection.
162155
The Apache server provided in the Docker setup supports this feature.
@@ -183,7 +176,7 @@ known issues, cache implications and the state of the support in popular
183176
browsers.
184177

185178
In addition to HTTP/2 Push and preloading, the WebLink component also
186-
provide some helpers to send `Resource
179+
provides some helpers to send `Resource
187180
Hints <https://www.w3.org/TR/resource-hints/#resource-hints>`__ to
188181
clients, the following helpers are available:
189182

0 commit comments

Comments
 (0)