# HTTP headers review

 

Use when reviewing or setting HTTP response headers for a web app or API - security headers (Content-Security-Policy, Strict-Transport-Security, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy), CORS headers, caching headers (Cache-Control, ETag, Last-Modified, Vary) and cookies (Set-Cookie flags). Also use when a security scan reports missing headers.

 

**Licence** MIT

 

**Source** delaparra-original

 [Download zip](<https://delaparra-services.nl/skills/http-headers-review/download>)   

# HTTP headers review

 

Inspect the headers an app actually sends, compare them to a safe baseline, and propose minimal changes in the right layer (web server, framework middleware, or CDN).

 

## Step 1: Inspect

 

```
curl -sI https://example.com/            # HTML page
curl -sI https://example.com/api/health  # API
curl -sI https://example.com/build/app.js # static asset
```

 

Check each type of response separately: pages, API responses and static assets need different caching.

 

## Step 2: Security baseline (HTML responses)

    Header Recommended starting value Notes     Strict-Transport-Security ` max-age=31536000; includeSubDomains ` Only on HTTPS. Add ` preload ` only when every subdomain is HTTPS   Content-Security-Policy Start with ` Content-Security-Policy-Report-Only ` and a tight policy, e.g. ` default-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'self' ` Switch to enforcing after reports are clean. Avoid ` 'unsafe-inline' ` for scripts; use nonces (Vite/Laravel support nonces)   X-Content-Type-Options ` nosniff ` Always   X-Frame-Options ` SAMEORIGIN ` (or CSP ` frame-ancestors `) Prevents clickjacking   Referrer-Policy ` strict-origin-when-cross-origin `    Permissions-Policy e.g. ` camera=(), microphone=(), geolocation=() ` Disable what the app does not use    

Remove headers that leak versions: ` X-Powered-By `, detailed ` Server ` values (` expose_php = Off ` in php.ini, ` server_tokens off; ` in Nginx).

 

## Step 3: Cookies

 

` Set-Cookie ` for sessions must have ` Secure `, ` HttpOnly ` and ` SameSite=Lax ` (or ` Strict `). In Laravel: ` SESSION_SECURE_COOKIE=true `, ` config/session.php ` ` same_site `. Use ` SameSite=None; Secure ` only when a cross-site cookie is truly required.

 

## Step 4: CORS (APIs)

 

- ` Access-Control-Allow-Origin `: list exact origins. ` * ` is only acceptable for fully public, credential-less APIs. 
- With cookies/credentials: ` Access-Control-Allow-Credentials: true ` and a specific origin, plus ` Vary: Origin `. 
- ` Access-Control-Allow-Methods ` / ` -Headers `: only what is used. ` Access-Control-Max-Age ` reduces preflight requests.

 

## Step 5: Caching

    Response Cache-Control     Fingerprinted assets (` app.3f9a.js `) ` public, max-age=31536000, immutable `   HTML pages ` no-cache ` (revalidate) or a short ` max-age `; use ` ETag `/` Last-Modified `   Authenticated/personal API data ` private, no-store `   Public API data ` public, max-age=60 ` plus ` ETag `    

Add ` Vary ` for any header that changes the response (` Accept-Encoding `, ` Origin `, ` Accept-Language `).

 

## Step 6: Apply in one place

 

Pick one layer per header (Nginx/Apache config, a Laravel middleware, or the CDN) to avoid duplicates. Verify with ` curl -sI ` again and report a before/after table.

 

## Rules

 

- Never enforce a new CSP without a report-only phase on an existing site. 
- Never enable HSTS ` preload ` without explicit confirmation from the owner.

 

## Files

 

- ` LICENSE ` 
- ` SKILL.md ` 
- ` SOURCE.md `

 

## Related terms

 

- [Accept](<https://delaparra-services.nl/knowledge-hub/accept>) 
- [Accept-Encoding](<https://delaparra-services.nl/knowledge-hub/accept-encoding>) 
- [Accept-Language](<https://delaparra-services.nl/knowledge-hub/accept-language>) 
- [Access-Control-Allow-Credentials](<https://delaparra-services.nl/knowledge-hub/access-control-allow-credentials>) 
- [Access-Control-Allow-Headers](<https://delaparra-services.nl/knowledge-hub/access-control-allow-headers>) 
- [Access-Control-Allow-Methods](<https://delaparra-services.nl/knowledge-hub/access-control-allow-methods>) 
- [Access-Control-Allow-Origin](<https://delaparra-services.nl/knowledge-hub/access-control-allow-origin>) 
- [Access-Control-Max-Age](<https://delaparra-services.nl/knowledge-hub/access-control-max-age>) 
- [Authorization](<https://delaparra-services.nl/knowledge-hub/authorization>) 
- [Cache](<https://delaparra-services.nl/knowledge-hub/cache>) 
- [Cache-Control](<https://delaparra-services.nl/knowledge-hub/cache-control>) 
- [Content-Length](<https://delaparra-services.nl/knowledge-hub/content-length>) 
- [Content-Security-Policy](<https://delaparra-services.nl/knowledge-hub/content-security-policy>) 
- [Content-Type](<https://delaparra-services.nl/knowledge-hub/content-type>) 
- [Cookie](<https://delaparra-services.nl/knowledge-hub/cookie>) 
- [CORSError](<https://delaparra-services.nl/knowledge-hub/corserror>) 
- [DNS (Domain Name System)](<https://delaparra-services.nl/knowledge-hub/dns-domain-name-system>) 
- [Edge computing](<https://delaparra-services.nl/knowledge-hub/edge-computing>) 
- [ETag](<https://delaparra-services.nl/knowledge-hub/etag>) 
- [Expires](<https://delaparra-services.nl/knowledge-hub/expires>) 
- [HTTP (Hypertext Transfer Protocol)](<https://delaparra-services.nl/knowledge-hub/http-hypertext-transfer-protocol>) 
- [If-Match](<https://delaparra-services.nl/knowledge-hub/if-match>) 
- [If-Modified-Since](<https://delaparra-services.nl/knowledge-hub/if-modified-since>) 
- [If-None-Match](<https://delaparra-services.nl/knowledge-hub/if-none-match>) 
- [Last-Modified](<https://delaparra-services.nl/knowledge-hub/last-modified>) 
- [Load balancer](<https://delaparra-services.nl/knowledge-hub/load-balancer>) 
- [Location](<https://delaparra-services.nl/knowledge-hub/location>) 
- [Origin](<https://delaparra-services.nl/knowledge-hub/origin>) 
- [Permissions-Policy](<https://delaparra-services.nl/knowledge-hub/permissions-policy>) 
- [Range](<https://delaparra-services.nl/knowledge-hub/range>) 
- [Referer](<https://delaparra-services.nl/knowledge-hub/referer>) 
- [Referrer-Policy](<https://delaparra-services.nl/knowledge-hub/referrer-policy>) 
- [Retry-After](<https://delaparra-services.nl/knowledge-hub/retry-after>) 
- [Set-Cookie](<https://delaparra-services.nl/knowledge-hub/set-cookie>) 
- [Slug](<https://delaparra-services.nl/knowledge-hub/slug>) 
- [Strict-Transport-Security](<https://delaparra-services.nl/knowledge-hub/strict-transport-security>) 
- [URL (Uniform Resource Locator)](<https://delaparra-services.nl/knowledge-hub/url-uniform-resource-locator>) 
- [User-Agent](<https://delaparra-services.nl/knowledge-hub/user-agent>) 
- [Vary](<https://delaparra-services.nl/knowledge-hub/vary>) 
- [WWW-Authenticate](<https://delaparra-services.nl/knowledge-hub/www-authenticate>) 
- [X-Content-Type-Options](<https://delaparra-services.nl/knowledge-hub/x-content-type-options>) 
- [X-Frame-Options](<https://delaparra-services.nl/knowledge-hub/x-frame-options>) 
- [X-Rate-Limit-\*](<https://delaparra-services.nl/knowledge-hub/x-rate-limit>)

 

[Installing an agent skill in Claude Code, Codex, Cursor and Copilot](<https://delaparra-services.nl/manuals/een-skill-installeren-in-je-ai-assistent>)

[HTML version](https://delaparra-services.nl/skills/http-headers-review)
