Skip to main content
Bethemesh
GuideBest practices

HTTP security headers: which ones to enable and why

Understand HSTS, CSP, X-Content-Type-Options, Referrer-Policy and Permissions-Policy and how to verify the headers actually returned.

Published 29 August 2026Reading : 1 minBy Bethemesh Team
Beginner
Show contents
  1. HSTS and HTTPS
  2. Prevent content-type guessing
  3. Control referrer information
  4. Restrict browser capabilities
  5. CSP belongs in the same review

HTTP response headers let a server tell the browser how to handle transport, content types, referrers, permissions and embedding. They are useful only when they are present in the actual response.

HSTS and HTTPS

Strict-Transport-Security asks browsers to use HTTPS for a period after a secure visit. Enable it only after HTTPS is reliable across the intended hostnames; a long max-age is a commitment.

Prevent content-type guessing

X-Content-Type-Options: nosniff tells browsers not to reinterpret declared MIME types. Correct Content-Type values still matter.

Control referrer information

Referrer-Policy limits how much URL information is sent when navigating or loading resources. A balanced policy can reduce accidental leakage without breaking useful origin information.

Restrict browser capabilities

Permissions-Policy can limit access to features such as camera, microphone or geolocation. Grant only capabilities the application actually needs.

CSP belongs in the same review

Content Security Policy is also an HTTP security header, but it is complex enough to deserve its own CSP guide. Avoid obsolete headers presented as universal modern protection.

Use the security headers generator, HTTP header analyzer and HTTP header builder, then verify the final production response rather than trusting an intermediate configuration.

Related tools

Security & privacy

Security headers generator

Generate HTTP security headers for the protections you want to enable on your site.

100% local
Use this tool
Development

HTTP Header Analyzer

Analyze HTTP headers to review security, caching, CORS, and cookie behavior.

100% local
Use this tool
Development

HTTP Header Builder

Build custom HTTP headers and get output ready to use in your requests.

100% local
Use this tool

Collection

Secure a website

  1. 01Web security: understand the essential protections of a website
  2. 02Content Security Policy (CSP): reduce XSS risks and unwanted loads
  3. 03HTTP security headers: which ones to enable and why
  4. 04Subresource Integrity (SRI): verify external resource integrity
  5. 05JWT: understand structure, signature, expiration and common mistakes
  6. 06Passwords: generation, strength and useful policies
  7. 07Hashes, integrity and fingerprint comparison: what a hash can really prove

Was this article useful?