Skip to content

HTTP / HTTPS Cheat Sheet: HTTP और HTTPS कैसे काम करता है?

Updated 7 Oct 2026 5 min scan

जब आप browser में कोई website open करते हैं, DNS domain को server के IP address तक पहुँचाने में help करता है।

लेकिन उसके बाद एक important सवाल आता है:

Browser और server आपस में बात कैसे करते हैं?

यहीं पर HTTP और HTTPS काम आते हैं।

Simple flow:

Code
Domain
  ↓
DNS
  ↓
IP Address
  ↓
HTTP / HTTPS
  ↓
Server
  ↓
Response
  ↓
Browser

इस cheat sheet में हम HTTP, HTTPS, request, response, methods, status codes, headers, cookies, HTTPS security और practical debugging को आसान Hinglish में समझेंगे।


HTTP क्या है?#

HTTP का full form है — HyperText Transfer Protocol.

HTTP एक protocol है जिसका use client और server के बीच communication के लिए किया जाता है।

Example:

Code
Browser → HTTP Request → Server

Browser ← HTTP Response ← Server

जब आप website खोलते हैं, browser server को request भेजता है।

Server request process करके response भेजता है।


HTTP को आसान भाषा में समझें#

मान लीजिए आप restaurant में जाते हैं।

आप कहते हैं:

“Mujhe एक Pizza चाहिए।”

यह आपकी request है।

Restaurant pizza देता है।

यह response है।

Internet में:

Code
Client
  ↓
Request
  ↓
Server
  ↓
Response
  ↓
Client

यही basic client-server communication है।


Client और Server क्या हैं?#

Client

जो request भेजता है।

Examples:

  • Web Browser
  • Mobile App
  • Frontend JavaScript
  • API Client

Server

जो request receive करके response देता है।

Examples:

  • Node.js Server
  • PHP Server
  • Nginx
  • Apache
  • API Server

Simple model:

Code
Client → Request → Server
Client ← Response ← Server

HTTP Request क्या है?#

जब client server से कुछ मांगता है, तो वह HTTP Request भेजता है।

Example:

Code
GET /products HTTP/1.1
Host: example.com

Request में कई important चीजें हो सकती हैं:

Code
HTTP Method
URL / Path
Headers
Body

HTTP Request के Main Parts#

एक request को broadly ऐसे समझें:

Code
Request
├── Method
├── URL / Path
├── Headers
└── Body

Example:

Code
POST /api/login HTTP/1.1
Host: example.com
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "password"
}

HTTP Method क्या है?#

HTTP Method बताता है कि client server से क्या operation करना चाहता है।

सबसे commonly used methods:

Code
GET
POST
PUT
PATCH
DELETE

GET#

GET का use data retrieve करने के लिए किया जाता है।

Example:

Code
GET /products

Meaning:

Server से products की information चाहिए।

Another example:

Code
GET /users/10

इसका मतलब हो सकता है:

User ID 10 की information चाहिए।


POST#

POST का use server को नया data भेजने या कोई operation trigger करने के लिए commonly किया जाता है।

Example:

Code
POST /users

Request body:

Code
{
  "name": "Rahul",
  "email": "rahul@example.com"
}

Server इस data के basis पर नया user create कर सकता है।


PUT#

PUT का use resource को update या replace करने के लिए किया जा सकता है।

Example:

Code
PUT /users/10
Code
{
  "name": "Rahul Sharma",
  "email": "rahul@example.com"
}

PATCH#

PATCH का use resource के कुछ specific fields update करने के लिए commonly किया जाता है।

Example:

Code
PATCH /users/10
Code
{
  "name": "Rahul Sharma"
}

यह केवल required field update कर सकता है।


DELETE#

DELETE का use resource delete करने के लिए किया जाता है।

Example:

Code
DELETE /users/10

Meaning:

User ID 10 को delete करना है।


HTTP Methods Quick Reference#

MethodCommon Purpose
GETData retrieve करना
POSTData create/send करना
PUTResource update/replace करना
PATCHPartial update
DELETEResource delete करना

HTTP Response क्या है?#

Server request process करने के बाद client को response देता है।

Example:

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

{
  "message": "Success"
}

Response में commonly ये चीजें होती हैं:

Code
Status Code
Headers
Body

HTTP Status Code क्या है?#

Status code बताता है कि request का result क्या हुआ।

Examples:

Code
200 → Success
404 → Not Found
500 → Server Error

Status codes generally 5 categories में होते हैं:

Code
1xx → Informational
2xx → Success
3xx → Redirection
4xx → Client Error
5xx → Server Error

1xx Status Codes#

ये informational responses होते हैं।

Example:

Code
100 Continue

Beginners के लिए सबसे important बात:

1xx = Information


2xx Status Codes#

ये generally successful requests को represent करते हैं।

200 OK

Request successfully process हुई।

Code
200 OK

201 Created

New resource create हुआ।

Code
201 Created

204 No Content

Request successful थी लेकिन response body में content नहीं है।

Code
204 No Content

याद रखें:

Code
2xx = Success

3xx Status Codes#

ये redirection से related होते हैं।

301 Moved Permanently

Resource permanently दूसरे URL पर move हुआ है।

302 Found

Temporary redirection के लिए commonly used status code।

304 Not Modified

Client के पास cached version अभी भी valid हो सकता है, इसलिए server नया content भेजने की जरूरत नहीं समझता।

Code
3xx = Redirection

4xx Status Codes#

ये client-side/request-related errors को indicate करते हैं।

400 Bad Request

Request invalid या malformed हो सकती है।

Code
400 Bad Request

401 Unauthorized

Authentication required है या authentication credentials acceptable नहीं हैं।

Code
401 Unauthorized

403 Forbidden

Server ने request समझी, लेकिन access allowed नहीं है।

Code
403 Forbidden

404 Not Found

Requested resource नहीं मिला।

Code
404 Not Found

405 Method Not Allowed

Requested HTTP method उस resource के लिए allowed नहीं है।

Code
405 Method Not Allowed

याद रखें:

Code
4xx = Request / Client Side Problem

5xx Status Codes#

ये server-side errors को indicate करते हैं।

500 Internal Server Error

Server पर unexpected error हुआ।

Code
500 Internal Server Error

502 Bad Gateway

Server/gateway को upstream server से invalid response मिला हो सकता है।

503 Service Unavailable

Server temporarily available नहीं है या service handle नहीं कर पा रही।

504 Gateway Timeout

Gateway/proxy को upstream server से समय पर response नहीं मिला।

याद रखें:

Code
5xx = Server Side Problem

HTTP Status Code Cheat Sheet#

CodeMeaning
200OK
201Created
204No Content
301Moved Permanently
302Found / Temporary Redirect
304Not Modified
400Bad Request
401Unauthorized
403Forbidden
404Not Found
405Method Not Allowed
500Internal Server Error
502Bad Gateway
503Service Unavailable
504Gateway Timeout

HTTP Headers क्या हैं?#

Headers request या response के बारे में additional information provide करते हैं।

Example:

Code
Content-Type: application/json

इसका मतलब है कि body में JSON data है।

कुछ common headers:

Code
Content-Type
Authorization
Accept
Cache-Control
Cookie
Set-Cookie
User-Agent
Location

Content-Type#

Content-Type बताता है कि request या response body का data किस format में है।

JSON:

Code
Content-Type: application/json

HTML:

Code
Content-Type: text/html

Plain text:

Code
Content-Type: text/plain

Form data:

Code
Content-Type: application/x-www-form-urlencoded

Authorization Header#

API authentication में commonly use होता है।

Example:

Code
Authorization: Bearer YOUR_TOKEN

इसका मतलब यह नहीं कि हर API इसी exact authentication method का use करती है, लेकिन Bearer tokens काफी common हैं।


Accept Header#

Client server को बता सकता है कि वह किस प्रकार का response accept कर सकता है।

Example:

Code
Accept: application/json

User-Agent#

User-Agent client/software के बारे में information provide कर सकता है।

Example:

Code
User-Agent: Mozilla/5.0

Browsers commonly User-Agent information send करते हैं।


HTTP Request Body#

Request body में client server को data भेज सकता है।

Example:

Code
POST /api/users
Content-Type: application/json

{
  "name": "Rahul",
  "age": 25
}

GET requests में generally data URL/query parameters में भेजा जा सकता है, जबकि POST/PUT/PATCH requests में body commonly use होती है।


Query Parameters#

URL में ? के बाद query parameters आ सकते हैं।

Example:

Code
https://example.com/products?page=2&limit=10

यहाँ:

Code
page = 2
limit = 10

Query parameters का use filtering, pagination, search आदि के लिए commonly होता है।

Example:

Code
/products?category=mobile

Path Parameters#

URL path में resource identify करने के लिए values use की जा सकती हैं।

Example:

Code
/users/25

यहाँ:

Code
25

user ID हो सकती है।

Compare करें:

Code
/users/25

vs

Code
/users?id=25

दोनों अलग URL designs हैं।


HTTP और HTTPS में Difference#

सबसे important difference:

Code
HTTP
↓
Unencrypted communication

HTTPS
↓
Encrypted communication

HTTPS का मतलब है:

HTTP Secure

HTTPS में HTTP communication को TLS के जरिए secure किया जाता है।


HTTPS क्यों जरूरी है?#

अगर website HTTPS use नहीं करती, तो network पर communication को protect करने के लिए modern encryption layer नहीं होती।

HTTPS तीन important security goals provide करने में मदद करता है:

Code
Confidentiality
Integrity
Authentication

Confidentiality

Communication को unauthorized parties से छिपाने में help करता है।

Integrity

Data रास्ते में modify हुआ या नहीं, इसे detect करने में help करता है।

Authentication

Certificate-based trust mechanism के जरिए server identity verify करने में help करता है।


HTTP vs HTTPS#

HTTPHTTPS
HTTP protocolHTTP over TLS
Encryption नहींTLS encryption
Security कमSecurity ज्यादा
URL http://URL https://
Sensitive data के लिए unsuitableSensitive data के लिए preferred

आज modern websites के लिए HTTPS standard practice है।


HTTPS कैसे काम करता है?#

Simplified flow:

Code
Browser
   ↓
HTTPS Connection
   ↓
TLS Handshake
   ↓
Certificate Verification
   ↓
Secure Session
   ↓
HTTP Request / Response

TLS handshake के दौरान browser और server secure communication establish करते हैं।

इसके बाद HTTP data encrypted connection के through transfer होता है।


SSL और TLS#

आपने अक्सर सुना होगा:

SSL Certificate

लेकिन modern HTTPS security में TLS protocol use होता है।

SSL एक older technology है।

Simple याद रखें:

Code
HTTPS
  ↓
TLS
  ↓
Secure HTTP Communication

आज नए systems में TLS terminology prefer की जाती है।


HTTPS Certificate क्या है?#

HTTPS website के पास generally a TLS certificate होता है।

Example:

Code
https://example.com

Browser certificate information check करता है और secure connection establish करने में इसका use करता है।

Certificate domain identity और cryptographic information से related होता है।


HTTP और HTTPS Ports#

Common default ports:

Code
HTTP  → 80
HTTPS → 443

Example:

Code
http://example.com
        ↓
Port 80

https://example.com
        ↓
Port 443

हालांकि applications custom ports पर भी run कर सकती हैं।


HTTP Request का Complete Example#

Browser request:

Code
GET /products HTTP/1.1
Host: example.com
Accept: application/json
User-Agent: Mozilla/5.0

Server response:

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

{
  "products": [
    {
      "id": 1,
      "name": "Laptop"
    }
  ]
}

Flow:

Code
Browser
   ↓
GET /products
   ↓
Server
   ↓
200 OK
   ↓
JSON Data
   ↓
Browser

API और HTTP#

Modern applications में frontend और backend अक्सर HTTP-based APIs के through communicate करते हैं।

Example:

Code
React App
    ↓
GET /api/products
    ↓
Backend
    ↓
Database
    ↓
JSON Response
    ↓
React App

Response:

Code
{
  "products": [
    {
      "id": 1,
      "name": "Laptop"
    }
  ]
}

REST API और HTTP Methods#

REST-style APIs में HTTP methods को resources के साथ commonly map किया जाता है।

Example:

OperationMethodEndpoint
List usersGET/users
Get userGET/users/10
Create userPOST/users
Update userPUT/users/10
Partial updatePATCH/users/10
Delete userDELETE/users/10

यह एक common REST pattern है; actual API design project के अनुसार अलग हो सकता है।


Cookies क्या हैं?#

Cookies browser में small pieces of data store करने के लिए commonly use होती हैं।

Common use cases:

  • Login/session
  • Preferences
  • Tracking
  • Shopping cart
  • Authentication state

Server cookie set कर सकता है:

Code
Set-Cookie: session_id=abc123

Browser बाद की requests में cookie भेज सकता है:

Code
Cookie: session_id=abc123

Cache-Control Header#

Caching behavior control करने के लिए Cache-Control header important है।

Example:

Code
Cache-Control: max-age=3600

यह caching policy define कर सकता है।

Caching website performance improve करने में help कर सकती है।


HTTP Redirect#

Server client को दूसरे URL पर redirect कर सकता है।

Example:

Code
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page

Browser Location header के basis पर new URL request कर सकता है।

Commonly:

Code
301 → Permanent redirect
302 → Temporary redirect

Browser DevTools में HTTP कैसे देखें?#

Chrome/Edge जैसे browsers में:

Code
Right Click
   ↓
Inspect
   ↓
Network

अब page reload करें।

आप requests देख सकते हैं:

Code
Document
CSS
JavaScript
Images
Fonts
Fetch/XHR

किसी request पर click करने पर आपको information मिल सकती है:

Code
Headers
Payload
Preview
Response
Timing

यह frontend debugging के लिए बहुत useful है।


Network Tab में क्या Check करें?#

अगर API काम नहीं कर रही है, तो सबसे पहले देखें:

Code
☐ Request URL
☐ HTTP Method
☐ Status Code
☐ Request Headers
☐ Request Payload
☐ Response
☐ Response Headers
☐ Timing

Example:

Code
POST /api/login
Status: 401

इससे पता चलता है कि request server तक पहुँची, लेकिन authentication-related problem हो सकती है।


Common HTTP Errors#

400

Code
Bad Request

Request format/data check करें।

401

Code
Unauthorized

Authentication/token check करें।

403

Code
Forbidden

Permissions/access check करें।

404

Code
Not Found

URL/endpoint check करें।

500

Code
Internal Server Error

Backend/server logs check करें।

502

Code
Bad Gateway

Proxy/gateway और upstream server check करें।

503

Code
Service Unavailable

Server/service availability check करें।

504

Code
Gateway Timeout

Upstream response delay/network/server issue check करें।


HTTP Troubleshooting Flow#

API या website problem होने पर:

Code
1. URL Check
      ↓
2. DNS Check
      ↓
3. Connection Check
      ↓
4. HTTP Method Check
      ↓
5. Request Headers
      ↓
6. Request Body
      ↓
7. Status Code
      ↓
8. Response Body
      ↓
9. Server Logs

यह flow debugging को systematic बनाता है।


HTTP और DNS का Connection#

DNS और HTTP अलग concepts हैं, लेकिन website open करते समय दोनों साथ काम करते हैं।

Basic flow:

Code
Browser
   ↓
DNS Lookup
   ↓
IP Address
   ↓
TCP Connection
   ↓
TLS Handshake
   ↓
HTTP Request
   ↓
HTTP Response
   ↓
Website

HTTPS में TLS step आता है।


Common Mistakes#

Mistake 1: 404 को Server Down समझना

404 का मतलब generally requested resource नहीं मिला।

Server completely down है, ऐसा जरूरी नहीं।


Mistake 2: 401 और 403 को Same समझना

Simple difference:

Code
401 → Authentication problem
403 → Access forbidden

Mistake 3: HTTP और HTTPS को केवल URL का Difference समझना

HTTPS केवल https:// लिखने से नहीं बनता।

HTTPS में TLS-based secure connection शामिल होती है।


Mistake 4: 500 का मतलब हमेशा Frontend Bug समझना

500 server-side error indicate करता है।

Backend code, dependencies, database, configuration या server environment check करना पड़ सकता है।


Mistake 5: Browser में Page Open हो रहा है तो API भी सही होगी

Website का frontend load हो सकता है, लेकिन API request fail हो सकती है।

इसलिए DevTools → Network में actual API request check करें।


HTTP / HTTPS Quick Reference#

Code
HTTP
→ HyperText Transfer Protocol

HTTPS
→ HTTP over TLS

HTTP Port
→ 80

HTTPS Port
→ 443

GET
→ Retrieve data

POST
→ Create/send data

PUT
→ Replace/update resource

PATCH
→ Partial update

DELETE
→ Delete resource

2xx
→ Success

3xx
→ Redirect

4xx
→ Client/request error

5xx
→ Server error

Important Status Codes याद रखें#

Code
200 → OK
201 → Created
204 → No Content

301 → Permanent Redirect
302 → Temporary Redirect
304 → Not Modified

400 → Bad Request
401 → Unauthorized
403 → Forbidden
404 → Not Found
405 → Method Not Allowed

500 → Internal Server Error
502 → Bad Gateway
503 → Service Unavailable
504 → Gateway Timeout

याद रखने की Trick

Code
2xx = Success
3xx = Redirect
4xx = You/Request side
5xx = Server side

Knowledge Check#

1. HTTP का full form क्या है?

A. HyperText Transfer Protocol
B. High Transfer Text Protocol
C. Hyper Transfer Technology Protocol
D. Host Transfer Protocol

Answer: A

2. HTTPS में security के लिए कौन सा protocol use होता है?

A. FTP
B. TLS
C. DNS
D. SSH

Answer: B

3. GET method का common purpose क्या है?

A. Data retrieve करना
B. Server delete करना
C. DNS configure करना
D. SSL install करना

Answer: A

4. 404 का क्या मतलब है?

A. Server Started
B. Unauthorized
C. Not Found
D. Bad Gateway

Answer: C

5. 500 status code किस type की problem indicate करता है?

A. Client-side
B. Server-side
C. DNS-only
D. Browser cache-only

Answer: B

6. HTTPS का default port कौन सा है?

A. 21
B. 22
C. 80
D. 443

Answer: D


Practical Exercises#

Exercise 1: Browser Network Tab

किसी website को open करें।

Code
Right Click
→ Inspect
→ Network
→ Reload

एक request select करें और देखें:

Code
Method
Status Code
Request URL
Headers
Response
Timing

Exercise 2: GET Request

Terminal में try करें:

Code
curl https://example.com

यह server से response प्राप्त करने का simple तरीका है।


Exercise 3: Headers देखें

Code
curl -I https://example.com

यह response headers inspect करने में useful है।


Exercise 4: HTTP Status Check करें

Code
curl -I https://example.com

Response में देखें:

Code
HTTP/...
200

या website के अनुसार कोई दूसरा status code।


Exercise 5: API Request समझें

किसी public API documentation से एक GET endpoint चुनें और identify करें:

Code
HTTP Method
URL
Headers
Response Status
Response Body

Summary#

इस HTTP / HTTPS Cheat Sheet में हमने सीखा:

  • HTTP क्या है
  • HTTPS क्या है
  • Client और Server
  • Request और Response
  • HTTP Methods
  • GET
  • POST
  • PUT
  • PATCH
  • DELETE
  • HTTP Status Codes
  • Request/Response Headers
  • Request Body
  • Query Parameters
  • Cookies
  • Cache-Control
  • Redirects
  • HTTPS और TLS
  • HTTP/HTTPS ports
  • APIs और REST
  • Browser Network DevTools
  • HTTP troubleshooting

सबसे important mental model:

Code
Client
  ↓
HTTP Request
  ↓
Server
  ↓
HTTP Response
  ↓
Client

और complete website flow:

Code
Domain
  ↓
DNS
  ↓
IP Address
  ↓
TCP Connection
  ↓
TLS (HTTPS)
  ↓
HTTP Request
  ↓
Server
  ↓
HTTP Response
  ↓
Browser

आगे क्या सीखें?#

अब तक हमने:

Code
Computer Fundamentals
        ↓
Terminal / Shell
        ↓
Git
        ↓
GitHub
        ↓
Internet Fundamentals
        ↓
DNS
        ↓
HTTP / HTTPS

सीख लिया है।

अगला topic होगा:

Browser DevTools Cheat Sheet

इसमें हम सीखेंगे कि browser के अंदर:

Code
Elements
Console
Network
Sources
Application
Storage
Performance

जैसी चीजों का use करके website और frontend को practically debug कैसे किया जाता है।