HTTP/2

Published on Author admin

http2

HTTP/2

or also named HTTP/2.0 is the second major version of the HTTP network protocol used by the World Wide Web since HTTP1/1. It is based on Google’s SPDY protocol. HTTP/2 is the new version of HyperText Transport Protocol
(HTTP), which was released as an IETF standard in early 2015. HTTP/2 support is now
available in some web servers. Nginx was the first web-server that began to support HTTP/2.

HTTP/2 is closely tied to SSL. While SSL is not required by the HTTP/2 specification, all web
browsers released so far will only run HTTP/2 if a website also uses SSL. HTTP/2 speeds up
SSL-enabled websites and makes web applications simpler.

HTTP/2 5 key features:
Single, Persistent Connection – Only one connection is used for each web page, as
shown in the figure. The same connection is used as long as the web page is open.

Multiplexing – Requests and replies are prioritized and multiplexed onto separate
streams within the single connection. When the connection is stable, “head of line
blocking” – making every transfer wait for all previous transfers to complete – is
eliminated.

Header Compression and Binary Encoding – Headers are compressed using a new,
separate, secure standard, HPACK compression, which reduces the amount of data
crossing the network. Header information is sent in compact, binary format, not as
plain text.

Prioritization – Requests are assigned levels of dependency and requests at the same
level are prioritized. The server uses this information to order and assign resources to
fulfilling requests.

SSL Encryption – HTTP/2 allows you to add SSL support with, in some cases, no
performance penalty, making your site more secure.

Nginx since 1.9.5 is HTTP/2 enabled by default.

To check your nginx is HTTP/2 enabled:

configure arguments must contains “-with-http_v2_module”

example:

For HTTP/2-enabled version of NGINX, do the following:
1. Add the http2 parameter and, if not already in place, the ssl parameter, to existing
listen directives – but first, add a URL redirector for HTTP/1.x:

2. Restart NGINX:

To test your web-site you can use http://http2.loadimpact.com/

NGINX_HTTP2_White_Paper_v4
Nginx white paper in HTTP2