Skip to main content

Command Palette

Search for a command to run...

HTTP & HTTPS Protocols

Published
•4 min read•View as Markdown
HTTP & HTTPS Protocols
A

I’m Arjun Saxena, a passionate software developer specializing in web engineering. I believe in writing code that creates real solutions to real problems. I love building efficient, user-friendly applications and constantly push myself to learn new technologies. Beyond coding, I enjoy sharing knowledge and growing together with others in the tech community.

How the Web Communicates Securely (Beginner-Friendly Guide)

Whenever you:

  • Open a website 🌐

  • Submit a login form 🔐

  • Call an API 📡

You are using HTTP or HTTPS.

In this article, we’ll understand:

  • What HTTP and HTTPS are

  • HTTP vs HTTPS (very important)

  • Role of SSL/TLS

  • HTTP methods and when to use them

  • Common HTTP status codes

  • Real-life examples for everything

No hard networking terms — just clarity.

1️⃣ What is HTTP?

Simple Definition:

HTTP (HyperText Transfer Protocol) is a set of rules that allows a browser and server to communicate.

It is the foundation of the web.

Real-Life Example:

Imagine a restaurant 🍽️

  • You (browser) → place an order

  • Waiter (HTTP) → carries request

  • Kitchen (server) → prepares food

  • Waiter → brings response

👉 HTTP is the waiter that carries messages.

2️⃣ How HTTP Works (Basic Flow)

https://media.geeksforgeeks.org/wp-content/uploads/20210905091508/ImageOfHTTPRequestResponse-660x374.png

Simple Flow:

  1. Browser sends HTTP request

  2. Server processes request

  3. Server sends HTTP response

  4. Browser displays content

3️⃣ HTTP vs HTTPS (Very Important)

What is HTTPS?

HTTPS is HTTP with security.

The extra S means Secure.

Key Difference (Easy Table)

FeatureHTTPHTTPS
Data encryption❌ No✅ Yes
Security❌ Unsafe✅ Secure
Uses SSL/TLS❌ No✅ Yes
URL starts withhttp://https://
Used forPublic dataLogin, payments

Real-Life Example:

📬 HTTP = Postcard (anyone can read)
🔐 HTTPS = Sealed envelope (private)

4️⃣ Why HTTPS Is Important?

Without HTTPS:

  • Passwords can be stolen ❌

  • Data can be modified ❌

  • Man-in-the-middle attacks ❌

With HTTPS:
✔ Data encrypted
✔ Identity verified
✔ User trust

👉 That’s why browsers show 🔒 lock icon.

5️⃣ Role of SSL/TLS in HTTPS

Simple Definition:

SSL/TLS encrypts data so attackers can’t read it.

What SSL/TLS Does:

  1. Encrypts data

  2. Verifies server identity

  3. Protects data during transfer

https://cf-assets.www.cloudflare.com/slt3lc6tev37/5aYOr5erfyNBq20X5djTco/3c859532c91f25d961b2884bf521c1eb/tls-ssl-handshake.png

https://www.cloudflare.com/img/learning/security/glossary/what-is-ssl/http-vs-https.svg

Simple Example:

When you submit a password:

mypassword123 ❌ (HTTP)
a8f@#9x!$... ✅ (HTTPS encrypted)

6️⃣ HTTP Methods (With Real Use Cases)

HTTP methods define what action you want to perform.

6.1 GET – Fetch Data

👉 Used to read data

GET /users

✔ Fetch users
✔ Fetch posts

6.2 POST – Send Data

👉 Used to create new data

POST /register

✔ Signup form
✔ Create user

6.3 PUT – Update Data (Full)

👉 Replace existing data

PUT /users/1

✔ Update profile completely

6.4 PATCH – Update Data (Partial)

👉 Update specific fields

PATCH /users/1

✔ Change email only

6.5 DELETE – Remove Data

👉 Deletes a resource

DELETE /posts/10

✔ Delete post

Summary Table

MethodPurpose
GETRead data
POSTCreate data
PUTUpdate full data
PATCHUpdate partial data
DELETERemove data

7️⃣ Common HTTP Status Codes

Status codes tell what happened to your request.

2xx – Success ✅

CodeMeaning
200OK
201Created

3xx – Redirection 🔁

CodeMeaning
301Moved permanently
302Temporary redirect

4xx – Client Error ❌

CodeMeaning
400Bad request
401Unauthorized
403Forbidden
404Not found

5xx – Server Error ⚠️

CodeMeaning
500Internal server error
502Bad gateway
503Service unavailable

Real-Life Example:

  • 404 = Wrong address 🏠

  • 500 = Kitchen problem 🍳

8️⃣ HTTP in Real Web Development

As a web developer, HTTP helps you:

  • Build APIs

  • Handle authentication

  • Debug network issues

  • Understand frontend-backend communication

👉 Every API call uses HTTP methods + status codes.