Limit frame-ancestors to sites you trust on nginx
Why it matters
frame-ancestors with * or a bare scheme lets any website frame your pages, which is exactly what clickjacking needs. List only your own origin and the partners that really embed you.
Staged change. Do this in stages and check each one before the next, so a mistake does not break your site or your mail.
The fix
- Stage 1: add a report-only header with the narrowed frame-ancestors and a reporting endpoint (as in the generic snippet) next to the current one, run sudo nginx -t and reload.
- Stage 2: replace the wildcard in the enforced Content-Security-Policy line and remove the report-only line.
Related
Scan your domain to see whether this applies to you.