Skip to main content

Command Palette

Search for a command to run...

Understanding HTTP vs HTTPS – How the Web Communicates Securely

Updated
4 min readView as Markdown

Over the past few days, I've learned how computers communicate through networks, how DNS helps locate websites, and how tools like cURL send requests to servers.

That naturally led me to another important question:

What exactly happens after a request is sent?

The answer begins with HTTP.


What is HTTP?

HTTP (HyperText Transfer Protocol) is the protocol that allows a client (such as a browser or cURL) to communicate with a web server.

Whenever you:

  • Open a website

  • Call an API

  • Submit a login form

  • Load an image

an HTTP request is being made.

Think of HTTP as the language that browsers and servers use to communicate.


How HTTP Works

Every communication follows a simple flow:

Client (Browser)

↓

HTTP Request

↓

Web Server

↓

HTTP Response

↓

Browser Displays the Result

The client sends a request.

The server processes it.

The server sends back a response.

Simple.


What Does an HTTP Request Contain?

An HTTP request usually includes:

  • Request Method (GET, POST, PUT, DELETE)

  • URL

  • Headers

  • Optional Body

Example:

GET /users HTTP/1.1
Host: example.com

What Does the Server Return?

The response usually contains:

  • Status Code

  • Headers

  • Response Body

Example:

HTTP/1.1 200 OK
Content-Type: application/json

Common HTTP Methods

GET

Retrieves information.

Example:

Getting a user's profile.


POST

Creates new data.

Example:

Creating a new account.


PUT

Updates an existing resource completely.


PATCH

Updates part of an existing resource.


DELETE

Removes data.

Example:

Deleting a comment.


HTTP Status Codes

Servers use status codes to tell clients what happened.

Some common ones are:

200 OK → Request succeeded.

201 Created → Resource created successfully.

301 Moved Permanently → Resource has moved.

400 Bad Request → Invalid request.

401 Unauthorized → Authentication required.

403 Forbidden → Permission denied.

404 Not Found → Resource doesn't exist.

500 Internal Server Error → Something went wrong on the server.

These codes make debugging much easier.


The Problem with HTTP

HTTP sends data as plain text.

That means anyone intercepting the connection could potentially read:

  • Usernames

  • Passwords

  • Messages

  • Credit card information

This creates a major security risk.


What is HTTPS?

HTTPS (HyperText Transfer Protocol Secure) is simply HTTP with an added layer of security.

It uses SSL/TLS encryption to protect communication between the client and the server.

Instead of sending plain text, the data is encrypted before it travels across the Internet.

Only the intended server can decrypt it.


Why HTTPS Matters

HTTPS provides three important guarantees:

Encryption

Protects data from being read by attackers.


Integrity

Ensures the data isn't modified during transmission.


Authentication

Confirms that you're communicating with the real website and not an imposter.

This is achieved using an SSL/TLS certificate issued by a trusted Certificate Authority (CA).


HTTP vs HTTPS

HTTP HTTPS
Data is sent in plain text Data is encrypted
Less secure Highly secure
Uses Port 80 Uses Port 443
No SSL/TLS Uses SSL/TLS
Suitable only for non-sensitive data Recommended for all modern websites

My Biggest Takeaway

Before today, I thought HTTPS simply meant "more secure."

Now I understand that it's much more than that.

HTTPS protects every piece of information exchanged between a client and a server using encryption, ensuring privacy and trust on the web.

Whether it's logging into an application, making an online payment, or calling an API, HTTPS is working silently in the background to keep our data safe.

As developers, understanding this communication layer is just as important as writing good code.

Every concept I learn helps me understand not only how to build applications, but also how the Internet actually works.

2 views

100 Days of Code: My Journey to Becoming a Full Stack Developer

Part 7 of 50

Welcome to my 100 Days of Code journey! In this series, I'll document my daily progress as I learn Full Stack Web Development from the ground up. Every post will cover what I learned, challenges I faced, mistakes I made, and the projects I built. My goal is not just to complete 100 days but to become a better developer through consistency, discipline, and learning in public. Topics I'll cover include: • Git & GitHub • HTML, CSS & JavaScript • React.js • Node.js & Express • MongoDB • APIs • Real-world Projects • AI tools for Developers Whether you're just starting out or revising your fundamentals, I hope this journey helps you learn alongside me. Let's build, learn, and grow together! 🚀

Up next

Understanding TCP vs UDP – Reliability vs Speed

Over the last few days, I've learned how browsers find websites using DNS, how HTTP enables communication between clients and servers, and how HTTPS secures that communication. Today, I went one layer

More from this blog

T

TheSaurceCode

73 posts

Documenting my journey to becoming a Full Stack Developer through daily blogs, coding challenges, projects, tutorials, and lessons learned. Learn, build, and grow with me