DNS and HTTP
DNS
The Domain Name System maps names to IP addresses.
Resolution
Browser cache -> OS cache -> Recursive resolver (ISP / 8.8.8.8)
-> Root server -> TLD server (.com) -> Authoritative server -> IP
Results are cached for the record's TTL.
| Record | Purpose |
|---|---|
| A / AAAA | Name to IPv4 / IPv6 |
| CNAME | Alias to another name |
| MX | Mail servers |
| NS | Authoritative name servers |
| TXT | Arbitrary text (SPF, verification) |
dig +short prepverse.vercel.app
HTTP
HTTP is a stateless request-response protocol, usually over TCP (HTTP/3 uses QUIC over UDP).
GET /docs HTTP/1.1
Host: prepverse.vercel.app
Accept: text/html
HTTP/1.1 200 OK
Content-Type: text/html
Cache-Control: public, max-age=0, must-revalidate
Methods
| Method | Use | Safe | Idempotent |
|---|---|---|---|
| GET | Read | Yes | Yes |
| POST | Create / action | No | No |
| PUT | Replace | No | Yes |
| PATCH | Partial update | No | Not guaranteed |
| DELETE | Remove | No | Yes |
Status codes
| Range | Meaning | Examples |
|---|---|---|
| 1xx | Informational | 101 Switching Protocols |
| 2xx | Success | 200 OK, 201 Created, 204 No Content |
| 3xx | Redirection | 301 Moved, 304 Not Modified, 308 Permanent Redirect |
| 4xx | Client error | 400, 401, 403, 404, 429 Too Many Requests |
| 5xx | Server error | 500, 502, 503, 504 |
Versions
| Version | Key idea |
|---|---|
| HTTP/1.1 | Persistent connections, but head-of-line blocking |
| HTTP/2 | Multiplexed streams, header compression |
| HTTP/3 | QUIC (UDP): faster handshakes, no TCP head-of-line blocking |
Cookies, caching and CORS
- Cookies add state on top of stateless HTTP (
Set-Cookie,HttpOnly,Secure,SameSite). - Caching uses
Cache-Control,ETagandLast-Modifiedfor conditional requests. - CORS is a browser policy: a page may call another origin only if that server allows it with
Access-Control-Allow-Origin.
Loading Comments...