HTTP headers and security headers explained
How to read HTTP response headers and redirects, and what HSTS, CSP, X-Frame-Options and the other security headers do.
Every time a browser fetches a page, the server sends a set of response headers before the content itself. They tell the browser what kind of content it is getting, how long it may be cached, where to go next if the page has moved – and, increasingly, which security rules to apply. The "Get HTTP headers" tool on webstriker shows all of them, follows every redirect, and points out missing security headers.
Status codes and redirects
The first line of a response contains the status code:
- 200 – OK, here is the page.
- 301 / 308 – moved permanently. Browsers and search engines remember the new address. Use these for http → https and non-www → www (or the reverse).
- 302 / 307 – moved temporarily. The original address stays the "real" one.
- 304 – not modified; the browser's cached copy is still good.
- 403 forbidden, 404 not found, 410 gone.
- 500, 502, 503 – server-side errors, often from a crashed application or an overloaded or misconfigured proxy.
webstriker requests one URL at a time and shows each step of the redirect chain separately. A good setup reaches the final page in one redirect – for example http://example.com → https://www.example.com/. Chains like http → https → www → /en/ → /en/home cost time on every first visit and are worth shortening.
Useful everyday headers
- Content-Type – what the content is (
text/html; charset=utf-8). - Cache-Control, Expires, ETag, Last-Modified – how long browsers and CDNs may cache the response, and how to check whether it has changed.
- Server, X-Powered-By – often reveal software and versions. Many administrators remove or shorten them to give attackers less information.
- Set-Cookie – cookies. Look for the
Secure,HttpOnlyandSameSiteattributes on session cookies. - Location – the target of a redirect.
The security headers
Strict-Transport-Security (HSTS). Tells the browser to use HTTPS for this site for a period of time, even if someone types or links to http://. Example: max-age=31536000; includeSubDomains. Only send it once HTTPS works everywhere, including all subdomains if you use includeSubDomains – the browser will refuse plain HTTP for the full max-age.
Content-Security-Policy (CSP). The most powerful and the most work. It lists where scripts, styles, images, frames and other resources may be loaded from, which makes cross-site scripting attacks far harder. A strict CSP needs to be tailored to each site; start with Content-Security-Policy-Report-Only to see what would break before enforcing it. Sites with advertising or many third-party scripts need a broad policy.
X-Content-Type-Options: nosniff. Stops browsers from guessing the content type and, for example, executing an uploaded text file as a script. There is no reason not to set it.
X-Frame-Options (DENY or SAMEORIGIN) – or the modern equivalent, frame-ancestors in CSP. Prevents other sites from embedding yours in a frame, which protects against clickjacking.
Referrer-Policy. Controls how much of the current URL is sent to other sites when a visitor follows a link. strict-origin-when-cross-origin is the browser default today and a sensible explicit choice.
Permissions-Policy. Switches off browser features the site does not use, such as camera, microphone or geolocation: camera=(), microphone=(), geolocation=().
How to add them
- Apache (.htaccess or virtual host):
Header always set X-Content-Type-Options "nosniff"(requires mod_headers). - nginx:
add_header X-Content-Type-Options "nosniff" always; - IIS: in
web.configunder<system.webServer><httpProtocol><customHeaders>, or via "HTTP Response Headers" in IIS Manager. - WordPress and other CMSs: a security plugin can usually add them, but setting them on the web server is more reliable.
- CDN or proxy: Cloudflare and similar services can add headers with transform rules.
The certificate
For HTTPS addresses, webstriker also shows the TLS certificate: whom it was issued to, which authority issued it, its validity dates and the host names it covers. A certificate that does not include the exact host name, or that has expired, causes the browser warning that makes most visitors leave. The CAA record in DNS controls which authorities may issue certificates for the domain at all.
Key takeaways
- Keep redirect chains short – ideally one hop to the final HTTPS address.
X-Content-Type-Options,Referrer-Policyand a frame policy are easy wins; HSTS and CSP need more care.- Check again after every server or CDN change – headers are easy to lose.