Security headers
Short instructions from your web server to the browser – they protect visitors against clickjacking, injected scripts and unencrypted connections.
- Web server
- Headers in the response
- Browser enforces rules
- Visitors protected
What eam.ch checks
| Header | Severity | Recommendation |
|---|---|---|
Strict-Transport-Security | medium | max-age=31536000, includeSubDomains only when all subdomains have HTTPS |
Content-Security-Policy | medium | enforcing; Report-Only does not count as set |
Cookies without Secure/HttpOnly | medium | Secure; HttpOnly; SameSite=Lax |
X-Frame-Options or CSP frame-ancestors | low | DENY or 'none'/'self' |
X-Content-Type-Options | low | nosniff |
Referrer-Policy | low | strict-origin-when-cross-origin |
Server/X-Powered-By with version | low | hide the version |
A website served under several names results in one finding per header (the other names are listed in the evidence). Names with a wrong certificate and mta-sts. are not checked for headers.
Example nginx
add_header Strict-Transport-Security "max-age=31536000" always; add_header Content-Security-Policy "default-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; server_tokens off;
PHP: expose_php = Off. Apache: ServerTokens Prod, Header always set … (mod_headers). In Plesk, the “HSTS” switch in SSL It! sets the first header; the others go under “Apache & nginx Settings” → “Additional nginx directives”. Webmail runs separately in Plesk.
Introducing CSP
- Start with
Content-Security-Policy-Report-Onlyand evaluate the browser console or areport-toendpoint. - Move inline scripts and styles into files or allow them with a nonce/hash; avoid
'unsafe-inline'. - Then switch to enforcing. Reference: OWASP Secure Headers Project, MDN.
In short
- Security headers are instructions to the browser.
- HSTS and CSP are the most important; introduce CSP in monitoring mode first.
- Hiding version details makes it harder to search for gaps.
- A few lines of configuration are usually enough.
Check it yourself
Commands to verify on Linux or macOS. Replace ihre-domain.ch with your domain and only check your own systems.
curl -sI https://www.ihre-domain.ch | grep -iE 'strict-transport|content-security|x-frame|x-content-type|referrer-policy'