How to check HTTP response headers
Every web response starts with a status line and a block of headers: short name and value pairs that control caching, security, redirects and cookies. You can read them with one terminal command or two clicks in your browser.
Method 1: curl in a terminal
curl -I example.com
curl -sIL example.com
curl -s -D - -o /dev/null example.com
-Isends a HEAD request and prints only the headers.-Lfollows redirects, printing each hop, and-shides the progress meter.- The third form sends a normal GET, prints the headers (
-D -) and throws away the body. Use it when a server answers HEAD differently from GET, which some do.
When you type a host without a scheme, curl uses plain unencrypted HTTP. Many sites answer that with a 301 to the secure version, so add -L to see the final response.
Method 2: browser DevTools
- Open the page, then open DevTools with F12, or Ctrl+Shift+I (Cmd+Option+I on a Mac).
- Choose the Network tab and reload the page.
- Click the first row, the document itself.
- Open Headers and scroll to Response Headers.
Tick “Disable cache” while DevTools is open if you want to see what the server sends now rather than a cached copy.
Reading the status line
| Code | Meaning | What to check |
|---|---|---|
| 200 | OK | Nothing; the page was served |
| 301 / 308 | Moved permanently | The Location header shows where |
| 302 / 307 | Moved temporarily | Fine for short-term moves; not for permanent ones |
| 304 | Not modified | The browser’s cached copy is still valid |
| 403 | Forbidden | Permissions, or a firewall rule |
| 404 | Not found | The path, or a missing redirect |
| 500 / 502 / 503 | Server-side error | Application logs, upstream servers, maintenance |
Headers worth understanding
| Header | Example value | What it does |
|---|---|---|
Content-Type | text/html; charset=utf-8 | Tells the browser how to treat the body |
Cache-Control | public, max-age=3600 | How long caches may reuse the response (here one hour) |
ETag | "a1b2c3" | A version tag the browser sends back to ask “has it changed?” |
Location | /new-page.html | The target of a redirect |
Strict-Transport-Security | max-age=31536000 | Tells browsers to use only the secure scheme for a year |
Content-Security-Policy | default-src 'self' | Limits where scripts, styles and images may load from |
X-Content-Type-Options | nosniff | Stops the browser guessing a different file type |
Referrer-Policy | strict-origin-when-cross-origin | Controls how much of the address is sent to other sites |
Set-Cookie | id=x; Secure; HttpOnly; SameSite=Lax | Stores a cookie with its safety flags |
The HSTS value 31,536,000 seconds is 365 days of 86,400 seconds each. On cookies, Secure keeps them off unencrypted connections, HttpOnly hides them from page scripts, and SameSite limits sending them with requests from other sites.
A quick audit routine
- Run
curl -sIL example.comand count the hops. One redirect to the final address is ideal; chains waste time. - Confirm the final status is 200 and the
Content-Typeis right. - Check that HTML has a short cache time and versioned static files a long one.
- Look for the security headers in the table. A missing one is a to-do, not an emergency.
- Inspect each
Set-Cookiefor the three flags.
Common mistakes
- Testing only one path. Headers can differ between the home page, static files and API routes.
- Trusting a cached view. A CDN may serve old headers; look for an age or cache-status header and test again after a purge.
- Turning on HSTS with a long max-age before every subdomain supports the secure scheme. Browsers will refuse the insecure ones until the time runs out.
Questions
Why is there no checker box on this page?
Fetching another site’s headers needs a network request from a server. The two methods above do the same job on your own machine.
Are header names case-sensitive?
No. content-type and Content-Type are the same header, and newer protocol versions send them in lowercase.