← 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
MethodPOST
Path/api/goals
VersionHTTP/1.1
Headers
Hostapi.studentos.xyz
AuthorizationBearer eyJhbGci...
Content-Typeapplication/json
Acceptapplication/json
Body (JSON)
{
"title":"Study React"
"date":"2026-03-06"
}
← HTTP Response
Status Line
VersionHTTP/1.1
Status Code201
Status TextCreated
Headers
Content-Typeapplication/json
Content-Length148
X-Request-IDreq_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
100Continue
101Switching Protocols
2xx — Success
200OK
201Created
204No Content
206Partial Content
3xx — Redirect
301Moved Permanently
302Found (temp)
304Not Modified
4xx — Client Error
400Bad Request
401Unauthorized
403Forbidden
404Not Found
422Unprocessable
429Rate Limited
5xx — Server Error
500Internal Error
502Bad Gateway
503Unavailable
504Gateway Timeout