HTTP headers explained: the metadata behind every request
Every HTTP request and response carries headers: key value pairs of metadata that travel alongside the body. The body is what you came for; the headers decide how it is handled. Most caching, security, and content negotiation behavior is controlled entirely through them.
Request headers: what the client wants
When your browser asks for a page, it describes itself and its preferences:
Hostnames the domain, so one server hosting many sites knows which you mean.User-Agentidentifies the browser and OS.Acceptlists the content types the client can handle, letting the server pick a format.Authorizationcarries credentials, often a bearer token.Cookiesends back the cookies the server set earlier.
Response headers: how to handle the result
The server replies with headers that often matter more than the body:
Content-Typedeclares what the body is, likeapplication/jsonortext/html; charset=utf-8. Get this wrong and the browser misinterprets everything.Cache-Controldecides caching: how long the response may be stored and by whom. This single header is responsible for most "why am I seeing the old version" confusion.Set-Cookiestores state on the client.Locationtells the browser where to go on a redirect.
The security headers worth knowing
A cluster of response headers harden a site, and their absence is a common audit finding:
Strict-Transport-Securityforces HTTPS for future visits.Content-Security-Policyrestricts what scripts and resources may load, the main defense against cross site scripting.X-Content-Type-Options: nosniffstops the browser guessing content types.Access-Control-Allow-Originis the CORS header that decides which other origins may read the response. If you have fought a CORS error, this header was the verdict.
Inspecting them
Headers are invisible in normal browsing but drive everything. When a response misbehaves, reading the actual headers the server sent is usually faster than guessing. The HTTP Headers tool fetches any URL and shows the full set of response headers, so you can confirm caching, content type, and security headers directly.