Traditional HTTP requests flow throught the network "pipe" (TCP connection) and the pipe only allows requests to flow in 1 direction ("to" or "from") and only 1 request can be be sent through the at once (Single-plexing).
HTTP 1.1 allows browser to form 6 such TCP connections to the server. This approach was quite expensive as servers held resource descritptors which eats a lot of server memory.
HTTP2 enabled multiplexing thought the same network pipe. The pipe has different streams and each stream carriers an ID which lets client map the responses to its respective client.
The server gets multiple requests with the stream ID from a client and its process those requests. The responses for those requests are then tagged with the respective stream ID and send back to the server.
If the client makes the request for a page like index.html
the client might also need other files like main.js
, main.css
and img.jpg
so just push them along with the response. This features need to be configured on the configured and the client should also be able to handle such responses.
HTTP/2 enables the compression of data as well as the headers also because there is a streamID already present as an identifier.
HTTP/2 can't be done on any port. It has to be on 443
We may inject our functionality when establishing the connection
The server might "push" unneccesary responses to the client overloading the stream while the client may have those resources cached on to its memory.
Mixed mode means that the server is supporting HTTP/2 while the intermediate load balancers, proxies or reverse proxies are supporting HTTP/1 only.