← back
Mirage
/
Web
/
HTTP Request / Response Flow
Web
Web
HTTP Request / Response Flow
Every step from typing a URL to seeing a page. DNS → TCP → TLS → server → database → response.
The Full Journey
🌐
Browser
client
DNS lookup
IP address
📖
DNS
name resolver
TCP + TLS handshake
HTTP Request →
← HTTP Response
⚙️
API Server
FastAPI
SQL query
rows returned
🗄️
Database
PostgreSQL
Timeline (typical page load)
0ms
DNS Lookup
resolve api.studentos.xyz → 203.0.113.42 (cached after first time)
10ms
TCP Handshake
SYN → SYN-ACK → ACK (3-way handshake establishes connection)
30ms
TLS Handshake
exchange certificates, agree on encryption (only for HTTPS)
60ms
HTTP Request sent
GET /api/goals — headers include Authorization: Bearer <token>
65ms
Server processes request
verify JWT → query DB → serialize JSON response
80ms
HTTP Response received
200 OK, Content-Type: application/json, body: [{...goals...}]
Request & Response Anatomy
→ HTTP Request
Request Line
Method
POST
Path
/api/goals
Version
HTTP/1.1
Headers
Host
api.studentos.xyz
Authorization
Bearer eyJhbGci...
Content-Type
application/json
Accept
application/json
Body (JSON)
{
"title":
"Study React"
"date":
"2026-03-06"
}
← HTTP Response
Status Line
Version
HTTP/1.1
Status Code
201
Status Text
Created
Headers
Content-Type
application/json
Content-Length
148
X-Request-ID
req_8f2a...
Body (JSON)
{
"success":
true
"data":
{ id, title, ... }
}
HTTP Methods
GET
read data. no body. idempotent — same result every call.
safe · idempotent
POST
create new resource. has body. NOT idempotent — creates a new item each call.
not idempotent
PUT
replace entire resource. idempotent — calling twice has same result as once.
idempotent
PATCH
partial update. only send the fields you want to change.
partial update
DELETE
remove a resource. idempotent — deleting twice same as once.
idempotent
Status Codes
1xx — Info
100
Continue
101
Switching Protocols
2xx — Success
200
OK
201
Created
204
No Content
206
Partial Content
3xx — Redirect
301
Moved Permanently
302
Found (temp)
304
Not Modified
4xx — Client Error
400
Bad Request
401
Unauthorized
403
Forbidden
404
Not Found
422
Unprocessable
429
Rate Limited
5xx — Server Error
500
Internal Error
502
Bad Gateway
503
Unavailable
504
Gateway Timeout