What is HTTP/2 and How To Enable

What is HTTP/2 and How To Enable
Published in : 29 Jul 2023

What is HTTP/2 and How To Enable

The advent of the internet has completely transformed how we engage in communication, obtain information, and carry out commercial activities. The Hypertext Transfer Protocol (HTTP) plays a crucial role in facilitating this global exchange of data between servers and clients. Over the years, HTTP has evolved to accommodate the increasing demands of modern web applications and user expectations. One such advancement is HTTP/2, which significantly improves website performance, speed, and efficiency. In this article, we will delve into the concept of HTTP/2, its key features, and how to enable it on your web server.

What is HTTP/2?

HTTP/2 is the second major version of the Hypertext Transfer Protocol (HTTP), succeeding HTTP/1.1. The primary goal behind its development was to address the limitations of its predecessor and enhance web performance by reducing latency and improving overall efficiency.

What Is Difference Between HTTP2 and HTTP?

The world of web communication has evolved significantly since the inception of the Hypertext Transfer Protocol (HTTP). As technology advances, so does the need for faster, more efficient, and secure data transmission. This drive for improvement led to the development of HTTP/2, the next generation of the HTTP protocol. In this article, we will explore the key differences between HTTP/2 and its predecessor HTTP, highlighting the revolutionary changes that HTTP/2 brings to the table.

Key Features of HTTP/2

  1. Multiplexing:
    One of the most significant improvements of HTTP/2 over HTTP is the introduction of multiplexing. In the traditional HTTP/1.x versions, browsers were limited to sending requests in a serial manner. This means that if a resource (e.g., an image or a script) took longer to load, it would block other resources from loading in parallel, leading to increased latency and slower page loading times.

    HTTP/2 solves this issue by allowing multiple requests and responses to be sent and received simultaneously over a single TCP connection. This multiplexing feature enables the server to prioritize and efficiently deliver resources, resulting in faster page load times and a more responsive user experience.

  2. Protocol Foundation:
    HTTP (Hypertext Transfer Protocol) has been the backbone of the World Wide Web for decades. It operates on a request-response model, where a client sends a request to the server, and the server responds with the requested data. This model served well for a long time but started showing limitations as web pages became more complex and data-intensive.

    HTTP/2, on the other hand, is a major revision of the HTTP protocol that builds upon the foundation of its predecessor. It was developed by the Internet Engineering Task Force (IETF) and introduced in 2015. HTTP/2 retains compatibility with HTTP, making it relatively easy for servers and browsers to transition to the new version.

  3. Binary Protocol:
    While HTTP/1.1 used plaintext for communication, HTTP/2 employs a binary protocol. This binary framing enables more efficient and faster parsing by servers and clients, making the data transfer more streamlined.
  4. Header Compression:
    In HTTP/1.x, headers sent with each request and response were not compressed, leading to unnecessary overhead, especially when making multiple requests. This contributed to increased latency and data transfer inefficiencies.

    HTTP/2 addresses this problem by using the HPACK compression algorithm to compress headers. By compressing headers before transmission, HTTP/2 significantly reduces the amount of data that needs to be sent over the network, resulting in faster communication between clients and servers

  5. Server Push:
    HTTP/2 introduces a groundbreaking feature known as "server push." With server push, the server can proactively send resources to the client before they are explicitly requested. This feature is particularly useful for websites with many dependencies, such as CSS, JavaScript, and images, as the server can preemptively push these resources to the client's cache, reducing the number of round trips needed to fetch them.

    Server push optimizes the loading process, leading to enhanced performance and reduced latency. However, it requires careful implementation, as unnecessary or redundant resource pushes can negate its benefits.

  6. Prioritization:
    With HTTP/2, clients can assign priority levels to individual resources, indicating their importance in the page load process. This allows for more efficient resource allocation, ensuring critical assets are fetched and displayed first, providing a better user experience.

How to Enable HTTP/2

The process of enabling HTTP/2 varies depending on the web server you are using. Below, we outline the steps to enable HTTP/2 on some of the popular web servers:

Enabling HTTP/2 on Apache

Step 1: Check Prerequisites

Before enabling HTTP/2, ensure you have the following:

  • Apache version 2.4.24 or later
  • OpenSSL version 1.0.2 or later
  • mod_http2 module enabled

Step 2: Update Apache Configuration

Open your Apache configuration file (httpd.conf) using a text editor and add the following lines:

"LoadModule http2_module modules/mod_http2.so"

Step 3: Enable HTTP/2 for a Domain

Locate the VirtualHost block for the domain you want to enable HTTP/2 on and add the following line within it:

"Protocols h2 http/1.1"

Step 4: Restart Apache

After making the modifications, save your changes and proceed to restart Apache in order to implement the updated configuration

Enabling HTTP/2 on Nginx

Step 1: Check Prerequisites

Before enabling HTTP/2, ensure you have Nginx version 1.9.5 or later, compiled with HTTP/2 support.

Step 2: Update Nginx Configuration

Open your Nginx configuration file (nginx.conf) or the configuration file for your specific site and add the following line in the server block:

"listen 443 ssl http2;"

Step 3: Restart Nginx

Save the changes and restart Nginx to enable HTTP/2 support.

Enabling HTTP/2 on Microsoft IIS

Step 1: Check Prerequisites

Ensure you have Windows Server 2016 or later, with HTTP/2 feature installed.

Step 2: Update IIS Configuration

Open the IIS Manager, select your server, and double-click on "HTTP/2" from the "Server Certificates" feature. Tick the checkbox labeled "Enable HTTP/2" and then press "Apply" to activate HTTP/2 on your IIS server.


HTTP/2 represents a significant advancement in web technology, promising faster, more efficient, and smoother web experiences for users. By allowing multiplexing, binary framing, header compression, server push, and prioritization, HTTP/2 optimizes data transfer and significantly reduces latency. Enabling HTTP/2 on your web server can be achieved by following the appropriate configuration steps for your chosen server type.

As HTTP/2 adoption continues to grow, it is becoming an essential aspect of website optimization and performance enhancement. Embracing HTTP/2 will not only benefit your users but also keep your website competitive and responsive in an ever-evolving digital landscape. So, go ahead and upgrade your server to HTTP/2, and unlock the full potential of modern web technology.