HiBlog Networking and Protocols

What Are HTTP and HTTPS, and How Are They Different?

  • Ali GhanimatiAuthor
  • Last updated
  • 6 minutesReading time
  • 1,441Views
  • Ali Ghanimati
  • Last updated:
  • 6 min read
  • 1,441 views
What Are HTTP and HTTPS, and How Are They Different?

Every time you type a website’s address into your browser, it starts with either http:// or https://, and next to the address there is either a padlock or a Not Secure warning. Those few letters decide whether the passwords, card numbers and messages you enter on the site reach the server encrypted, or travel like a postcard that anyone along the way can read!

In this article we explain in plain words what HTTP and HTTPS are, how each one works, how they differ, what role SSL and TLS play in HTTPS, and how to move your own site to HTTPS.

Short answer: HTTP is the language the browser and the web server talk in, and it sends data unencrypted. HTTPS is the same HTTP carried inside a connection encrypted with TLS: nobody along the way can read or change the data, and the browser checks the site’s identity with its SSL certificate. Today every site, even the simplest blog, should use HTTPS.

What is HTTP?

What the HTTP protocol is

HTTP (Hypertext Transfer Protocol) is one of the internet’s most important application-layer protocols; it carries the conversation between the browser (the client) and the web server. When you open a site’s address, the browser sends a request to the server over HTTP, and the server answers with a response that holds the page’s content: HTML, images, CSS and JavaScript. HTTP uses port 80 by default.

How does HTTP work?

How HTTP works with requests and responses

HTTP communication follows a request and response model:

  1. The browser opens example.com and gets the server’s IP from DNS.
  2. An HTTP request goes to the server, for example “give me the home page”.
  3. The server sends back a response with a status code and the page’s content.
  4. The browser displays the content and sends further requests for the page’s images and other files.

The parts of an HTTP request and response

  • Start line: in a request, the method (such as GET to fetch and POST to submit a form) and the page’s path; in a response, the status code.
  • Headers: extra information as name and value pairs, such as the browser type, the content type and size, and cookies.
  • Body: the content itself, such as the page’s HTML, an API’s JSON data or the form data you submitted.

HTTP status codes

For every response, the server returns a three-digit code that tells the result of the request. Knowing these codes matters for troubleshooting your site and for its Google ranking:

  • 200 OK: the request succeeded.
  • 301 Moved Permanently: the address has changed for good; exactly what you need when moving a site from http to https.
  • 403 Forbidden: the server refuses access. See how to fix the 403 error.
  • 404 Not Found: the page wasn’t found.
  • 500 Internal Server Error: something went wrong on the server’s side. See our guide to fixing the 500 error on hosting.

HTTP’s big problem: no encryption

HTTP is simple and fast, but it has no encryption. Passwords, card numbers and users’ messages travel between the browser and the server as plain text, and anyone along the way, for example on a public Wi-Fi network, can read them or even change them. HTTPS was built to solve exactly this problem.

What is HTTPS?

What the HTTPS protocol is

HTTPS (Hypertext Transfer Protocol Secure) is the same HTTP placed inside a tunnel encrypted with the TLS protocol. Before any data is exchanged, the browser and the server agree on a shared encryption key, and the browser checks the server’s SSL certificate to make sure it is really talking to that site and not to a fake one. HTTPS uses port 443 by default, and the browser shows the padlock next to the address to signal a secure connection.

HTTP vs. HTTPS: the differences

The differences between HTTP and HTTPS
FeatureHTTPHTTPS
EncryptionNone; data is plain textYes, with TLS
Site identity checkNoneWith an SSL certificate
Default port80443
In the browserNot Secure warningPadlock
HTTP/2 and HTTP/3 in browsersNot supportedSupported

Put simply, if HTTP is a conversation in a crowded hall, HTTPS is the same conversation behind closed doors. A nice bonus: browsers only use the newer, faster versions of the protocol, HTTP/2 and HTTP/3, over HTTPS, so HTTPS is not only safer but often faster too.

Why every site should use HTTPS

The benefits of HTTPS
  • It protects users’ data: passwords, payment details and forms are safe from eavesdropping and tampering.
  • More trust: browsers show a Not Secure warning next to HTTP sites, and that warning drives visitors away, especially on payment pages.
  • Better Google ranking: Google treats HTTPS as a ranking signal.
  • No man-in-the-middle attacks: nobody along the way can inject ads or malicious code into your pages.
  • More speed: it unlocks HTTP/2 and HTTP/3.

What are SSL and TLS, and what do they do in HTTPS?

The role of SSL and TLS in HTTPS

SSL (Secure Sockets Layer) and TLS (Transport Layer Security) are the encryption protocols HTTPS is built on. SSL is the old version and was retired years ago because of security weaknesses; today HTTPS connections use TLS 1.2 and TLS 1.3. Out of habit, though, people still call a site’s certificate an “SSL certificate”.

An SSL certificate is a digital file signed by a certificate authority (CA) that states this encryption key really belongs to this domain. With a valid certificate:

  • the server’s identity is confirmed to the browser;
  • data between the user and the server is encrypted;
  • any change to the data along the way is detected and rejected.

How to enable HTTPS on your site

Moving a site to HTTPS takes three things:

  1. Install an SSL certificate: on cPanel hosting this is free and almost automatic with AutoSSL or Let’s Encrypt; see how to install SSL in cPanel. With HiData’s Certify you can also get a free SSL certificate for a domain with any extension.
  2. Redirect http to https with a 301: so all visitors and search engines go to the secure version.
  3. Fix mixed content: any image or file still loaded over http:// breaks the browser’s padlock. Our guide to fixing the Mixed Content error walks you through it step by step.
Enabling HTTPS on a website

Frequently asked questions

Does HTTPS mean a site is completely safe?

No. HTTPS only secures the path between you and the site. A fake or infected site can have an SSL certificate too; the browser’s padlock means the connection is secure, not that the site’s owner can be trusted.

What is HSTS?

HSTS is a header a site sends to the browser saying “from now on, only come to me over HTTPS”. With it, even if a user types http://, the browser goes to HTTPS on its own. Only turn it on once HTTPS works correctly on all your subdomains.

Is a free SSL certificate enough, or should I buy one?

The encryption of a free Let’s Encrypt certificate is no different from a paid one. Paid certificates are mostly for when you need your organisation’s identity verified or dedicated support.

Hosting with SSL, ready for HTTPS

If you want your site to launch secure and on HTTPS from day one, take a look at HiData’s professional cPanel hosting: you install the SSL certificate right from cPanel, and we move your current site from your old host for free and without downtime.

Sources

Share Post

hidata.org/en/blog/what-is-http-and-https/
In Social Media

Add Comment

Related Articles