Originally published on Sitecheckly.
Missing security headers are HTTP response headers absent from a page’s response that could instruct browsers to apply protections. Check the affected URL, add headers appropriate to your application, and test the response again. Sitecheckly found “Missing security headers” on 84% of the 103 sites audited in the last 90 days.
What do missing security headers mean?
The finding concerns the response for the URL tested. It does not establish that every page on the site has the same problem. Sitecheckly audits one page per run, so treat the result as a finding for that page.
HTTP response security headers let a server communicate browser-facing policies. Depending on the header, those policies can limit content-type guessing, control referrer information, or require HTTPS for future connections. MDN’s practical security implementation guides explain how these protections fit together.
Start with the specific header names flagged in the report. An absent header is a reason to review the page’s configuration, not a reason to paste every available policy into production. Use the security headers list and recommended values to decide which policies fit your application.
The survey figure above describes findings in Sitecheckly audits. It is not an estimate of how often the issue occurs across the entire web, and it does not show that every finding was exploitable.
How do you check a page for missing security headers?
Enter the affected URL in the free security headers checker. Review the returned header names and values, rather than relying only on a pass or fail label.
For a separate passive check of the entered page, run a Sitecheckly security audit. It is free, requires no sign-up, and audits one URL per run. It does not scan the whole site.
Use this checking method before making changes:
- Record the exact URL. Keep it for the verification run.
- Follow the result through any redirects. Inspect the final page response, not just the response that redirects to it.
- Record what is missing. Keep a short list of the flagged header names and any values already present.
- Find the configuration owner. Identify whether the application, web server, reverse proxy, or CDN manages the response you are checking.
Keep the same page-level scope when interpreting the survey: a finding on a tested URL is not evidence that every URL on that site has identical headers.
Before editing configuration, also check whether another layer already sets the headers. Apache’s documentation specifically describes how headers from different response tables and upstream applications can produce duplicates. Its mod_headers guidance is useful when tracing that problem.
How do you add security headers in Nginx?
Add the following directives inside the existing server or location block that handles the affected URL:
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
These are starting-point policies, not a complete security configuration:
-
X-Content-Type-Options: nosnifftells browsers to respect the declared content type rather than reinterpret applicable responses through MIME sniffing. It does not correct an incorrectContent-Type. See MDN’s X-Content-Type-Options reference. -
Referrer-Policy: strict-origin-when-cross-originallows full referrer information for same-origin requests, limits eligible cross-origin requests to the origin, and omits the referrer on HTTPS-to-HTTP requests. See MDN’s Referrer-Policy reference.
Review existing add_header directives before applying the change. Placement matters. Under Nginx’s default inheritance behavior, adding an add_header directive at a lower configuration level can prevent that level from inheriting the parent’s add_header directives. The always parameter applies the header regardless of the response code. Check the Nginx headers module documentation against your configuration before deciding where to put the directives.
Apply the change in this order:
- Save a copy of the current configuration.
- Add the directives in the block responsible for the page.
- Test the Nginx configuration and resolve any errors.
- Reload Nginx using your deployment’s normal procedure.
- Check the public URL again.
Do not stop at a successful configuration test. The result you need is the intended headers on the live page response.
How do you add security headers in Apache?
With mod_headers enabled, add these directives in the applicable virtual host or directory configuration:
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Use this Apache configuration instead of the Nginx example. Choose the configuration that actually serves the affected response.
Before saving the change, review existing Header directives and headers returned by an upstream application. Apache maintains separate header tables, so Header always set does not automatically eliminate every duplicate created elsewhere. The Apache mod_headers documentation explains always, directive scope, and duplicate-header considerations.
Then:
- Save a copy of the current configuration.
- Confirm that
mod_headersis enabled. - Add the directives in the applicable configuration.
- Test the Apache configuration and fix any errors.
- Reload Apache using your normal deployment procedure.
- Inspect the live page response for the intended names and values.
If a header appears more than once, investigate the existing directives and upstream response before adding more configuration. The goal is an intentional policy, not merely a header name appearing somewhere in the response.
How do you verify the fix and choose additional headers?
Run the security headers checker again on the same URL. Follow redirects and confirm that the intended headers appear on the final response.
Check both the names and values:
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
A header’s presence alone is not enough. For example, nosniff still requires you to serve resources with the correct content type, as explained in MDN’s X-Content-Type-Options documentation. Check that the page and its resources still work after deployment.
Test other important URLs separately. Include pages handled by different applications, server blocks, or proxy paths. Keep a small verification record with the URL, expected headers, and observed result so the scope of the fix is clear.
Plan Content Security Policy around the page
Do not treat a generic Content Security Policy as a drop-in fix. Build the policy around the resources the page actually needs. Use the CSP report-only guide to test a proposed policy before enforcing it.
Confirm HTTPS before enabling HSTS
Strict-Transport-Security tells browsers to use HTTPS for future requests to the host during the policy’s lifetime. Browsers only accept it over HTTPS. Review MDN’s HSTS guide before choosing a policy, especially one that includes subdomains.
Confirm that HTTPS works correctly before deployment. The HSTS setup guide provides a focused path for that change. Do not add HSTS solely to clear a missing-header warning without checking its scope.
What to do next
- Fix the flagged page at the layer that controls its response.
- Test and reload the relevant server configuration.
- Verify the public response on the same URL.
- Check other important URLs individually and plan additional policies separately.
Frequently asked questions
Does X-Content-Type-Options fix an incorrect Content-Type?
No. Set the correct Content-Type for each resource; nosniff tells browsers not to reinterpret applicable responses as a different type. See MDN.
Does Referrer-Policy hide every referrer?
Not necessarily. The strict-origin-when-cross-origin policy can send the full referrer for same-origin requests and the origin for eligible cross-origin requests. See MDN.
Can a security header be present but ineffective?
Yes. A header can be present with an invalid or unsuitable value, so check its value and behavior rather than only its presence. Consult the relevant header documentation, such as MDN’s Referrer-Policy reference.
Want to see how your own site does? Run a free audit at sitecheckly.com.
Figures in this article come from Sitecheckly's own audit data; see the methodology.
Top comments (0)