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.1 HTTP messages, URLs and statelessness
  2. 1.2 Methods, safety and idempotency
  3. 1.3 Status codes: success, redirects and client errors
  4. 1.4 Server errors, proxies and gateways
  5. 1.5 Headers and content negotiation
  6. 1.6 Cookies, state and HTTP clients
  7. 1.7 HTTP caching and conditional requests
  8. 1.8 Connections, HTTP/2 and HTTP/3
  9. 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

  1. Which part of this request is the request target? ```http GET /api/users?page=2 HTTP/1.1 Host: example.com Accept: application/json ```

    1. `application/json`
    2. `HTTP/1.1`
    3. `example.com`
    4. `/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.

  2. Which HTTP methods are defined as idempotent?

    1. GET, HEAD, PUT, DELETE and OPTIONS
    2. POST, PATCH and PUT
    3. Only GET and POST
    4. 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.

  3. A request to create a resource succeeds. Which status code fits best?

    1. `204 No Content`, with the resource in the body
    2. `201 Created`, with a `Location` header
    3. `302 Found`, pointing at the collection
    4. `200 OK`, with an empty body

    Answer: B. `201 Created`, with a `Location` header `204` means success with no body at all.

  4. A reverse proxy can't reach the app server behind it. What status does the client most likely see?

    1. `404 Not Found`, from the proxy
    2. `502 Bad Gateway`, or `504` on timeout
    3. `401 Unauthorized`, from the proxy
    4. `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.

  5. What does the `Content-Type` header describe?

    1. The type of client software making the request
    2. The media type of the body, like `application/json`
    3. How long the response may be cached by browsers
    4. 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`).

  6. What does `Set-Cookie: sid=abc; HttpOnly; Secure; SameSite=Lax; Path=/` do?

    1. Deletes all of the site's existing cookies and starts a new session
    2. Stores the value in localStorage so that page scripts can read it
    3. Sets a cookie that the browser sends to every website the user visits
    4. 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.

  7. What does `304 Not Modified` mean?

    1. The client's cached copy is still valid; no body sent
    2. The client's session expired and it must log in
    3. The resource has been deleted from the server
    4. 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`.

  8. What does `Transfer-Encoding: chunked` let an HTTP/1.1 server do?

    1. Send several separate responses to one request
    2. Encrypt each piece of the response separately
    3. Stream a response without knowing its total length
    4. 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.

  9. A site shows the browser's HTTPS padlock. What does that not guarantee?

    1. That the connection is encrypted between the browser and the server
    2. That data in transit can't be read or changed by someone on the network
    3. That the server proved it controls the domain in the address bar
    4. 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.

  10. Why is HTTP described as stateless?

    1. Cookies and sessions aren't permitted anywhere in HTTP
    2. Servers aren't allowed to store any data between requests
    3. Each request stands alone; the protocol keeps no memory of earlier ones
    4. 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.

Practice all 261 questions

More Server Side