Skip to content
ohsudo, Home

HTTP Headers Analyzer

Paste the output of curl -I to check security headers, CORS, cookies, caching and redirects, with the nginx lines to fix them.

● Runs 100% in your browser — nothing you type leaves this page.

Run one of these, on your own machine

$ curl -sIL https://example.com/
$ curl -sI -H 'Origin: https://app.example.com' https://example.com/api/

🔒 Checked in your browser and never sent or stored. Headers can hold session cookies, so this text isn't kept in the page address either.

How to use it

  1. Run curl against your site, from a terminal. -I asks only for the headers, -L follows redirects, and -s hides the progress bar.
  2. Paste the result. curl -v output works too.
  3. Read what it found, worst first, and copy the nginx lines for anything you want to fix.

Why do I have to paste it?

Your browser won’t let a web page read another site’s headers, and this site has no server of its own to fetch them for you. There’s a benefit, though: you can check an internal site, or a staging server that’s not on the internet, and nothing you paste leaves your browser. It isn’t stored or put in the page address, because headers can contain session cookies.

What it checks

Group Headers
Security Strict-Transport-Security, Content-Security-Policy, X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy
Cookies Secure, HttpOnly and SameSite on every Set-Cookie
CORS Access-Control-Allow-Origin and -Credentials, and Vary: Origin
Giving things away Versions in Server, X-Powered-By
Caching Cache-Control, and what a CDN reports
Redirects Missing Location, redirects to plain HTTP, long chains

It reads text, so it doesn’t test your site: it can’t tell whether a CSP suits your pages, or try an attack. A clean result means these headers look right, not that the site is secure.

Testing CORS

A server usually only sends CORS headers when the request has an Origin, so plain curl -I may show nothing. Pretend to be the other site:

Terminal window
curl -sI -H 'Origin: https://app.example.com' https://api.example.com/items

For the preflight that browsers send before a PUT or a request with a custom header:

Terminal window
curl -si -X OPTIONS https://api.example.com/items \
-H 'Origin: https://app.example.com' \
-H 'Access-Control-Request-Method: PUT'

Adding the headers in nginx

The Nginx Config Generator can add the security headers for you. Otherwise, put the suggested lines inside your server block. Two rules catch people out:

Terminal window
sudo nginx -t && sudo systemctl reload nginx
curl -sI https://example.com/ | grep -i strict-transport

FAQ

Should I turn on HSTS right away?

Not before HTTPS works on every address you use. Browsers remember it for as long as max-age says, so if the certificate breaks, visitors can’t click past the warning. Start with a short value, such as max-age=300, then raise it. Add includeSubDomains only if all subdomains have HTTPS.

A strict CSP broke my site

That’s common, as it blocks inline scripts and anything from other domains. Send Content-Security-Policy-Report-Only first. Nothing gets blocked, and the browser’s console lists what would have been. Fix those, then switch to the real header.

Why did it warn about the Server header?

A version number tells attackers which known holes to try. Hiding it isn’t protection on its own, so keep updating. In nginx, server_tokens off; removes the number.

My browser says “blocked by CORS policy”. What now?

Check the real response here, using the Origin command above. The usual reasons are a missing header, * together with credentials, or the header appearing twice because both your app and your proxy add it. For the fixes, see Blocked by CORS policy.

Can it find a redirect loop?

Not by itself, but the list of responses can show one starting. If the browser says “too many redirects”, see ERR_TOO_MANY_REDIRECTS.

Articles

Learn more