Networking

What is HTTP/2?

HTTP/2 is a major revision of the HTTP protocol that improves web performance through multiplexing, header compression, server push, and binary framing, allowing multiple requests and responses to be sent simultaneously over a single connection.

How Does HTTP/2 Work?

HTTP/1.1 required a separate TCP connection for each request-response pair, meaning browsers had to open multiple parallel connections to load a page quickly. HTTP/2 solves this with multiplexing: multiple streams of data can flow over a single connection concurrently without blocking each other. It also compresses HTTP headers using the HPACK algorithm, reducing overhead for the repetitive headers sent with every request.

Additional features include server push, which allows the server to proactively send resources it knows the client will need before they are explicitly requested, and stream prioritization, which lets the browser indicate which resources are most important. HTTP/2 uses a binary framing layer instead of text-based parsing, making it more efficient to parse and less error-prone. Most modern web servers and browsers support HTTP/2, and it is automatically enabled on HTTPS connections.