Developer and Text Tools

How to Read and Fix HTTP Headers: Caching, Cookies and Security

What Cache-Control, Set-Cookie and security headers do, the common mistakes, and how to check and fix the HTTP headers your own site sends.

Saizul Amin
Saizul Amin30 Oct 2026 · 3 min read
How to Read and Fix HTTP Headers: Caching, Cookies and Security

How to Read and Fix HTTP Headers

Every web response comes with headers that most people never see. They decide whether browsers cache your pages, whether cookies can be stolen by scripts, whether your site can be framed by an attacker, and whether text is compressed. Small mistakes here cause stale pages after a release, logins that break across sites, and security scanners full of red. The free HTTP Headers Reference and Parser explains any headers you paste and flags common problems. This guide covers the ones that matter most.

Getting the headers

Run curl -I https://your-site.example to see a response's headers, or open your browser's developer tools, choose the Network tab, click a request and copy the response headers. Paste them into the parser, including the first status line.

Caching

Cache-Control is the main caching header.

  • Fingerprinted assets (files with a hash in the name, like app.3f9a1c.js) can be cached for a year: public, max-age=31536000, immutable. A new release uses a new file name, so nobody sees an old file.
  • HTML pages should use no-cache. Despite the name, this allows storing the page but makes the browser check with the server (using the ETag) before reusing it, so new releases appear at once.
  • Private data such as account pages: private, so shared caches and CDNs do not store it.
  • Sensitive data such as banking pages: no-store, so nothing is kept at all.

A common mistake is mixing no-cache with max-age, which shows confusion about what no-cache means; the parser flags it.

Cookies

A session cookie should carry three attributes. Secure sends it only over HTTPS. HttpOnly hides it from JavaScript, so a script injected into your page cannot read it. SameSite=Lax (or Strict) stops it being sent on most cross-site requests, which blocks many cross-site request forgery attacks. If you need a cookie on cross-site requests, SameSite=None must be combined with Secure or browsers reject it. The __Host- prefix goes further: such a cookie must be Secure, have Path=/ and no Domain, so subdomains cannot overwrite it.

Security headers

  • Strict-Transport-Security makes browsers use HTTPS for your site for the max-age period. Use at least six months; a year is common.
  • Content-Security-Policy lists where scripts, styles and other resources may come from. It is the strongest defence against injected scripts, but must be written for your site.
  • X-Content-Type-Options: nosniff stops browsers guessing file types.
  • X-Frame-Options or CSP frame-ancestors stop other sites framing yours (clickjacking).
  • Referrer-Policy controls how much of your URLs is shared with other sites.
  • Permissions-Policy switches off browser features such as camera and microphone you do not use.

Remove headers that reveal your software, such as X-Powered-By: Express, which only helps attackers.

Methods and REST

The reference also lists HTTP methods with whether each is safe and idempotent. That matters for retries: a GET or PUT can be repeated safely, a POST may create a duplicate unless the API supports an Idempotency-Key. The REST checklist covers naming, status codes, paging, versioning and the Problem Details format for errors.

Using the builders

Choose the kind of content to get the right Cache-Control line, and fill in a cookie name, SameSite mode and lifetime to get a hardened Set-Cookie line.

Where to fix them

Headers can be added by your application, your web server (Nginx, Apache) or your CDN, and a later layer can override an earlier one. After changing them, paste the new headers into the parser again to confirm. Everything runs in your browser; nothing is fetched or uploaded.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages