Security header problems: missing headers, cookies and leaks
Security headers are instructions that the server sends so that browsers protect your visitors. These checks look for a missing Content-Security-Policy, framing protection, X-Content-Type-Options, Referrer-Policy and Permissions-Policy, cookies without security flags, and information that should not be public, such as possible secrets, internal addresses, source maps, software versions and a missing security.txt. Add the headers and remove what is exposed.
How the problem happens
Defaults of a server or framework do not include these headers, and nobody adds them. Debug files, source maps and test addresses are published with the code and stay online after release.
Why security headers and leaks matter for search and AI visibility
Security headers are instructions that tell the browser how strictly to treat your pages: where scripts may load from, whether the site may be framed by another one, whether file types may be guessed, how much of the address is passed to other sites. They are not a direct ranking factor, and adding them will not lift a page. Their value is indirect but real. A site that is compromised can be injected with spam links, redirected to a malicious page or flagged as unsafe, and may then lose rankings and traffic; whether AI systems also cite such a site less often is not documented.
The other half of this family looks at what a site gives away. A secret key in public JavaScript, an internal IP address, a staging address, a public source map or a version number in a header each make an attack easier or reveal infrastructure. A staging host that leaks into live code can also end up in the index if crawlers reach it. Cookies without Secure, HttpOnly or SameSite are easier to steal or misuse. None of this changes your title or your content, but it changes how much of the site you can still call your own.
How to check security headers by hand
Request the home page and an inner page with curl -I and read the response headers. Look for Content-Security-Policy, X-Frame-Options or the frame-ancestors directive, X-Content-Type-Options: nosniff, Referrer-Policy and Permissions-Policy. Also look at what is present that should not be: a Server header with an exact version, or X-Powered-By naming the language and version. Check the Set-Cookie lines for the Secure, HttpOnly and SameSite flags.
Then read the public code. View the source and the loaded scripts and search for strings that look like keys or tokens, for localhost, staging, .internal, private IP ranges such as 192.168. and 10., and for sourceMappingURL comments. Try /.well-known/security.txt. If a script file ends with a map reference and the .map file opens, your original source is public. Browser developer tools show blocked resources and policy violations in the console, which helps when you test a new policy.
# roll out CSP in report-only mode first, then enforce
add_header Content-Security-Policy-Report-Only "default-src 'self'; img-src 'self' https:; script-src 'self'" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
server_tokens off;
# cookie flags on a session cookie
Set-Cookie: sid=abc; Secure; HttpOnly; SameSite=Lax; Path=/How to fix security headers and leaks in code, server and CMS
Set headers once, at the server or CDN, so every response gets them. Start with the safe ones: X-Content-Type-Options: nosniff, a Referrer-Policy such as strict-origin-when-cross-origin, a Permissions-Policy that disables features you do not use, and framing protection through frame-ancestors or X-Frame-Options. Introduce Content-Security-Policy carefully, first in report-only mode, because a policy that is too strict can break scripts, fonts or embeds; tighten it step by step as the reports come in.
Mark session and login cookies Secure, HttpOnly and SameSite. Hide version numbers in server and framework settings. Remove secrets from client code and rotate any key that was exposed, since deleting it from the page does not undo the exposure. Keep development and staging addresses out of production builds, do not publish source maps, and publish a security.txt file with a contact address so researchers can reach you.
How RankDossier detects security header problems
RankDossier reads the response headers and the public code of the pages it crawls. The checks in this family report a missing Content-Security-Policy, missing framing protection, a missing X-Content-Type-Options, Referrer-Policy and Permissions-Policy, cookies without security flags, strings that look like leaked secrets, development URLs and internal IP addresses in public code, public source maps, disclosed software versions and a missing security.txt. A hit on a possible secret is a pattern match, so treat it as a lead to verify, not as proof.
Each finding shows the header or the snippet that triggered it. The technical SEO audit guide places security among the base technical signals, the site migration guide reminds you to keep staging addresses out of the live site, the guide to controlling crawlers explains how to keep private paths away from bots, and the website audit tool guide shows how these checks sit in a full audit report.
Wrong and right
Wrong
HTTP/2 200
Server: nginx/1.18.0
Set-Cookie: session=abc123
Right
HTTP/2 200
Content-Security-Policy: default-src 'self'
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Set-Cookie: session=abc123; Secure; HttpOnly; SameSite=Lax
How to fix it
WordPress
Add the headers with a security plugin or in the server configuration, remove debug and backup files from the web root, and keep WordPress, themes and plugins updated to hide old versions.
Next.js
Return the headers from the headers function in next.config.js, set the Secure, HttpOnly and SameSite flags on cookies, and turn off public source maps in the production build.
// next.config.js
module.exports = {
async headers() {
return [{ source: '/(.*)', headers: [
{ key: 'X-Content-Type-Options', value: 'nosniff' },
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
] }];
},
};
Nginx
Add each header with add_header and the always flag, set server_tokens off to hide the version, and block files such as .env or .git from being served.
server_tokens off;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
Check codes in this family
These checks belong to this family. Each code appears in the audit report with its own explanation and fix.
SEC_CSP_MISSINGContent-Security-Policy is missingSEC_XFO_MISSINGNo framing protectionSEC_XCTO_MISSINGX-Content-Type-Options is missingSEC_REFERRER_MISSINGReferrer-Policy is missingSEC_PERMISSIONS_MISSINGPermissions-Policy is missingSEC_COOKIE_FLAGSCookies without security flagsSEC_SECRET_LEAKPossible leaked secretSEC_DEV_URL_LEAKDevelopment URLs in public codeSEC_INTERNAL_IPInternal IP addresses in public codeSEC_SOURCE_MAPPublic source mapsSEC_VERSION_DISCLOSURESoftware versions disclosedSEC_SECURITY_TXTsecurity.txt is missing
Related check families
Read the full guide How to run a technical SEO audit and prioritize the fixes for the wider picture.
Check your own site
Enter a domain – the free pre-check reads up to 10 pages and shows how many types of problems it finds. You pay only if you want the full report.
Start the free pre-check