The HTTPS protocol
The HTTPS protocol is an extension of HTTP, the Hyper Text Transfer Protocol, that provide secure communication
HTTP is insecure by design.
When you open your browser and ask a web server to send you a webpage, your data performs 2 trips: 1 from the browser to the web server, and 1 from the web server to the browser.
Then, depending on the content of the web page, you might have more connections required to get the CSS files, the JavaScript files, images, and so on.
During any of those connections, any network your data is going to cross can be inspected and manipulated.
The consequences can be serious: you might have all your network activity monitored and logged, by a 3rd party you are not even aware it exist, some networks might inject ads, and you might be subject to a man-in-the-middle attack, a security threat where the attacker can manipulate your data and even impersonate your computer over the network. It’s very easy for someone to just listen to HTTP packets being transmitted over a public and unencrypted Wi-Fi network.
HTTPS aims to solve the problem at the root: the entire communication between your browser and the web server is encrypted.
Privacy and security are a major concern in today’s internet. A few years ago, you could get away with just using an encrypted connection in login-protected pages, or during an e-commerce checkout. Also because of SSL certificates pricing and complications, most websites just used HTTP.
Today HTTPS is a requirement on any site. More than 50% of the whole Web uses it now. Google Chrome recently started marking HTTP sites as insecure, just to give you a valid reason to have HTTPS mandatory (and forced) on all your websites.
When using HTTP the default server port is 80, and on HTTPS it’s 443. It does not need to be explicitly added if the server uses the default port, of course.
HTTPS is also sometimes called HTTP over SSL, or HTTP over TLS.
The difference between the two is simple: TLS is the successor of SSL.
When using HTTPS, the only thing that is not encrypted is the web server domain, and the server port.
Every other information, including the resource path, headers, cookies and query parameters are all encrypted.
I won’t go in the details of analyzing how the TLS protocol works under the hoods, but you might think it’s adding a good amount of overhead, and you would be right.
Any computation that’s added to the processing of network resources causes overhead both on the client, the server, and to the transmitted packets size.
However HTTPS enables the use of the newest protocol HTTP/2, which has a huge advantage over HTTP/1.1: it way faster.
Why? There are many reasons, one is header compression, one is resource multiplexing. One is server push: the server can push more resources when one resource is requested. So, if the browser requests a page, it will also receive all the resources needed (images, CSS, JS).
Details aside, HTTP/2 is a huge improvement over HTTP/1.1 and it requires HTTPS. This means that HTTPS, despite having the encryption overhead, happens to be way faster than HTTP, if things are properly configured with a modern setup.
→ I wrote 17 books to help you become a better developer, download them all at $0 cost by joining my newsletter
→ JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025