HTTP fundamentals: methods, status codes, headers and caching – Server Side interview prep
261 interview-style multiple-choice questions on HTTP fundamentals: methods, status codes, headers and caching, organized by topic: concepts, scenarios, code to read and tradeoffs, each with a short explanation. Learn the 110 key terms with the flashcards first, then test yourself.
Take the practice test · Flashcards · All study tools
What it covers
- 1.1 HTTP messages, URLs and statelessness
- 1.2 Methods, safety and idempotency
- 1.3 Status codes: success, redirects and client errors
- 1.4 Server errors, proxies and gateways
- 1.5 Headers and content negotiation
- 1.6 Cookies, state and HTTP clients
- 1.7 HTTP caching and conditional requests
- 1.8 Connections, HTTP/2 and HTTP/3
- 1.9 TLS and HTTPS in practice
Key terms
1.1 HTTP messages, URLs and statelessness
- Authority
- Host plus optional port
- Percent-encoding
- %XX bytes in URLs
- Status line
- Version, code, reason
- Pseudo-headers
- :method, :path, :status
- Request smuggling
- Framing disagreement attack
- Absolute form
- Full URL as target
- CONNECT
- Opens a tunnel
- RFC 9110
- HTTP Semantics
- Expect: 100-continue
- Approve before body
- Punycode
- ASCII form of IDNs
1.2 Methods, safety and idempotency
- Idempotent
- Repeating the request has the same effect as sending it once
- Safe method
- A method that doesn't request a change on the server
- Idempotency key
- Client-supplied ID that lets a server ignore duplicate requests
- Stateless
- Each request is independent of earlier ones
- TRACE
- Echoes the request
- Cacheable methods
- GET and HEAD by default
- Automatic retry
- Allowed for idempotent methods
- If-None-Match: *
- Create only if absent
- WebDAV methods
- PROPFIND, MKCOL
- Full replacement
- PUT replaces all state
- Form resubmission
- Refresh repeats a POST
- GOAWAY last stream
- Unprocessed streams are safe to retry
- Incidental side effects
- Logging or counters on GET
1.3 Status codes: success, redirects and client errors
- 2xx
- Success status codes
- 4xx
- Client error status codes
- 5xx
- Server error status codes
- Retry-After
- Header telling the client when to try again
- 307 vs 302
- 307 keeps method and body
- 308
- Permanent, keeps method
- Redirect loop
- Rules redirecting to each other
- 413
- Content Too Large
- 451
- Blocked for legal reasons
- 425
- Too Early
- 416
- Range Not Satisfiable
- Unknown status
- Treated as x00 of its class
- 421
- Misdirected Request
- 511
- Network auth required
1.4 Server errors, proxies and gateways
- 504
- Gateway Timeout
- Forward proxy
- Acts for clients
- Trusted proxies
- Only trust their X-Forwarded-For entries
- Via
- Proxies the message passed through
- Keep-alive mismatch
- App timeout shorter than LB's
- Hop-by-hop headers
- Connection, Keep-Alive, Upgrade
- Host header injection
- Spoofed Host poisons links
- Connection draining
- Finish in-flight, take no new
- Slowloris
- Slow headers exhaust connections
- PROXY protocol
- Client address over TCP LBs
- Negative caching
- CDNs caching errors
1.5 Headers and content negotiation
- Content-Type
- Media type of the body
- Accept
- Media types the client can handle
- Content negotiation
- Choosing a response format from what the client accepts
- X-Forwarded-For
- Original client IP added by proxies
- q-value
- Preference weight 0–1
- Content-Language
- Language of the response
- charset
- Text encoding parameter
- Content-Disposition
- Inline or attachment download
- Structured Fields
- Standard header value syntax
- Proactive negotiation
- Server picks from headers
- multipart/form-data
- Form with files
- +json suffix
- Format built on JSON
- Content-Digest
- Hash of the body
- Client Hints
- Opt-in device details
- BREACH
- Compression side-channel
1.6 Cookies, state and HTTP clients
- Cookie header
- Names and values only
- Max-Age
- Wins over Expires
- 400-day cap
- Max cookie lifetime in Chrome
- Signed cookie
- Tamper-proof, readable
- Cookie jar
- Client-side cookie store
- curl -L
- Follow redirects
- curl --resolve
- Pin a host to an IP
- Happy Eyeballs
- Race IPv6 and IPv4
- NO_PROXY
- Hosts that skip the proxy
- httpoxy
- Proxy header hijacks HTTP_PROXY
- HAR file
- Recorded browser traffic
1.7 HTTP caching and conditional requests
- Cache-Control
- Header with caching directives
- no-store
- Directive that forbids storing the response
- TLS
- Transport Layer Security, the encryption under HTTPS
- QUIC
- UDP-based transport used by HTTP/3
- If-Modified-Since
- Date-based revalidation
- must-revalidate
- No stale serving without checks
- Age
- Seconds spent in cache
- Vary: *
- Effectively uncacheable
- If-Range
- Resume only if unchanged
- Pragma: no-cache
- HTTP/1.0 legacy
- CDN-Cache-Control
- CDN-only caching rules
- Cache poisoning
- Harmful response stored
- no-transform
- Proxies must not alter the body
- Cache-Status
- Hit or miss per cache
1.8 Connections, HTTP/2 and HTTP/3
- Alt-Svc
- Advertises alternative protocols
- HTTPS DNS record
- Connection hints in DNS
- HPACK / QPACK
- Header compression
- Connection coalescing
- One connection, many hostnames
- Connection migration
- QUIC survives network changes
- Extensible Priorities
- Priority header
- Rapid Reset
- Stream cancel flood
- h2c
- Cleartext HTTP/2
- Nagle's algorithm
- Batches small writes
- END_STREAM
- Marks last frame
1.9 TLS and HTTPS in practice
- Certificate chain
- Leaf plus intermediates
- SAN
- Hostnames a cert covers
- Wildcard certificate
- Covers one label
- DNS-01
- ACME TXT record challenge
- Shorter cert lifetimes
- 200 days in 2026, 47 by 2029
- Certificate Transparency
- Public issuance logs
- CAA record
- Allowed CAs for a domain
- Forward secrecy
- Past traffic safe if key leaks
- ECH
- Hides SNI
- Hybrid PQ key exchange
- X25519MLKEM768
- OCSP stapling
- Server attaches revocation status
- CSR
- Public key plus names for a CA
Sample practice questions
Which part of this request is the request target? ```http GET /api/users?page=2 HTTP/1.1 Host: example.com Accept: application/json ```
- `application/json`
- `HTTP/1.1`
- `example.com`
- `/api/users?page=2`
Answer: D. `/api/users?page=2` The `Host` header names the server; the request line carries the method, target and version.
Which HTTP methods are defined as idempotent?
- GET, HEAD, PUT, DELETE and OPTIONS
- POST, PATCH and PUT
- Only GET and POST
- Every method, as long as HTTPS is used
Answer: A. GET, HEAD, PUT, DELETE and OPTIONS Idempotent means repeating the same request has the same effect on the server as sending it once.
A request to create a resource succeeds. Which status code fits best?
- `204 No Content`, with the resource in the body
- `201 Created`, with a `Location` header
- `302 Found`, pointing at the collection
- `200 OK`, with an empty body
Answer: B. `201 Created`, with a `Location` header `204` means success with no body at all.
A reverse proxy can't reach the app server behind it. What status does the client most likely see?
- `404 Not Found`, from the proxy
- `502 Bad Gateway`, or `504` on timeout
- `401 Unauthorized`, from the proxy
- `201 Created`, with an empty body
Answer: B. `502 Bad Gateway`, or `504` on timeout 502 means the gateway got an invalid response or no connection upstream.
What does the `Content-Type` header describe?
- The type of client software making the request
- The media type of the body, like `application/json`
- How long the response may be cached by browsers
- The compression level the server applied
Answer: B. The media type of the body, like `application/json` Servers should reject or ignore bodies with a type they don't support (`415 Unsupported Media Type`).
What does `Set-Cookie: sid=abc; HttpOnly; Secure; SameSite=Lax; Path=/` do?
- Deletes all of the site's existing cookies and starts a new session
- Stores the value in localStorage so that page scripts can read it
- Sets a cookie that the browser sends to every website the user visits
- Sets an HTTPS-only cookie scripts can't read, withheld on most cross-site requests
Answer: D. Sets an HTTPS-only cookie scripts can't read, withheld on most cross-site requests These attributes are the common baseline for session cookies.
What does `304 Not Modified` mean?
- The client's cached copy is still valid; no body sent
- The client's session expired and it must log in
- The resource has been deleted from the server
- The server refuses to let the resource be changed
Answer: A. The client's cached copy is still valid; no body sent It answers a conditional request with `If-None-Match` or `If-Modified-Since`.
What does `Transfer-Encoding: chunked` let an HTTP/1.1 server do?
- Send several separate responses to one request
- Encrypt each piece of the response separately
- Stream a response without knowing its total length
- Split one request across several backend servers
Answer: C. Stream a response without knowing its total length HTTP/2 and HTTP/3 have their own framing and don't use chunked encoding.
A site shows the browser's HTTPS padlock. What does that not guarantee?
- That the connection is encrypted between the browser and the server
- That data in transit can't be read or changed by someone on the network
- That the server proved it controls the domain in the address bar
- That the site is honest; it only means the connection to that domain is encrypted and authenticated
Answer: D. That the site is honest; it only means the connection to that domain is encrypted and authenticated Phishing sites get valid certificates too.
Why is HTTP described as stateless?
- Cookies and sessions aren't permitted anywhere in HTTP
- Servers aren't allowed to store any data between requests
- Each request stands alone; the protocol keeps no memory of earlier ones
- Connections are closed after every single byte is sent
Answer: C. Each request stands alone; the protocol keeps no memory of earlier ones State such as sessions is layered on top with cookies or tokens.
More Server Side
- REST API design
- GraphQL
- gRPC & real-time APIs
- OAuth 2.0, OIDC & JWT
- Sessions, cookies & web app security
- C# & .NET
- Java & Spring Boot
- Node.js & Express
- Python, Django & FastAPI
- Go (Golang)
- Concurrency & multithreading
- OOP & SOLID
- Design patterns
- Dependency injection
- Logging & observability
- Data structures
- Algorithms & Big-O
- Linux & shell scripting