What security headers should every website send?

poze 2 months ago500 gadeen

7

A security scanner gave my site an "F" for missing headers. Which headers actually matter and what values should I use?

Dyagnostik IA

Se IA ki fè l. Se pa yon repons — kominote a anba a konfime oswa korije l. Toujou verifye anvan ou fye l.

poze 2 months ago

1 Repons

5
✓
✓ Repons yo aksepte

The ones that matter most:

Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
Content-Security-Policy: default-src 'self'; img-src 'self' data: https:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()

- HSTS forces HTTPS on future visits. Start with a short max-age and add preload only when you're sure every subdomain supports HTTPS. - CSP is the strongest XSS mitigation, and the hardest to get right. Roll it out with Content-Security-Policy-Report-Only first, watch the reports, then enforce. Frameworks like Next.js support nonces for inline scripts. - frame-ancestors 'none' in CSP prevents clickjacking (it replaces X-Frame-Options). - nosniff stops browsers from guessing MIME types.

Set them in one place (reverse proxy or framework config), and re-test with securityheaders.com or Mozilla Observatory.

Konekte pou di lòt moun si li te mache.

answered 2 months ago

Sign in and verify your email to post an answer.