How to Fix Server Version Disclosure in HTTP Headers
Many web servers and frameworks add software version numbers to every response, such as `Server: nginx/1.24.0` or `X-Powered-By: PHP/8.2.12`. This guide removes the version numbers from the Server, X-Powered-By, X-AspNet-Version, X-AspNetMvc-Version and X-Generator headers on your homepage. It then shows you how to confirm the headers are clean.

Why it matters
A version number tells automated scanners exactly which known vulnerabilities (CVEs) to try against your site. Hiding it does not patch anything, and it has no effect on rankings or AI answers. It does remove an easy reconnaissance shortcut, and security questionnaires, pentest reports and compliance scans (PCI DSS, ISO 27001 audits) routinely flag it.
The fix takes a few lines of config, so it is worth doing alongside keeping the software itself updated.
What you need
Step-by-step fix
See which headers leak a version
Request your homepage and list the response headers. Look for a version pattern such as 1.24 or 8.2.12 in these headers:
- Server
- X-Powered-By
- X-AspNet-Version
- X-AspNetMvc-Version
- X-Generator
A product name alone, such as Server: nginx or Server: cloudflare, is fine. Only the version digits are the problem.
curl -sI https://example.com/ | grep -iE '^(server|x-powered-by|x-aspnet-version|x-aspnetmvc-version|x-generator):'
Turn off version tokens in nginx
conf and add server_tokens off; inside the http { } block. 0 to Server: nginx. If PHP-FPM or a proxied app (Node, Python, Java) adds X-Powered-By, hide it at the nginx layer as well.
Then test the config and reload nginx.
http {
server_tokens off;
fastcgi_hide_header X-Powered-By;
proxy_hide_header X-Powered-By;
proxy_hide_header X-AspNet-Version;
proxy_hide_header X-Generator;
}
# then run:
# sudo nginx -t && sudo systemctl reload nginxSet ServerTokens Prod in Apache
conf. conf. Set the two directives below.
htaccess. Next, enable mod_headers (sudo a2enmod headers on Debian/Ubuntu) and unset X-Powered-By. Finally, run sudo apachectl configtest` and reload Apache.
ServerTokens Prod
ServerSignature Off
<IfModule mod_headers.c>
Header always unset X-Powered-By
Header unset X-Powered-By
</IfModule>Stop PHP announcing its version
PHP adds X-Powered-By: PHP/8.x.x unless expose_php is off. Run php --ini to find the active php.ini; for PHP-FPM, check under /etc/php/8.x/fpm/. Set the value below, then restart PHP-FPM, for example sudo systemctl restart php8.3-fpm, or restart Apache if you use mod_php.
; php.ini expose_php = Off
Remove ASP.NET and IIS version headers
config. They remove X-AspNet-Version and X-Powered-By, and drop the Server header on IIS 10+. cs.
)`.
<configuration>
<system.web>
<httpRuntime enableVersionHeader="false" />
</system.web>
<system.webServer>
<security>
<requestFiltering removeServerHeader="true" />
</security>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>Strip version headers at the app or CDN layer
Some versioned headers come from the application itself, such as an X-Generator header from a CMS plugin or an X-Powered-By header set by Express. You can remove them in two places:
- In the app: in Express, call
app.disable('x-powered-by'); in Next.js, setpoweredByHeader: false. - At the CDN: if you cannot touch the origin, remove the header at the edge. In Cloudflare, go to Rules > Transform Rules > Modify Response Header, create a rule, choose Remove and enter
X-Powered-By(repeat for any other header).
// Express
const app = express();
app.disable('x-powered-by');
// next.config.js
module.exports = { poweredByHeader: false };Purge caches and re-check the headers
Clear your CDN and any page cache so that cached responses with the old headers stop being served. Run the same curl command as in step 1 against the homepage, both over HTTPS and after any redirects. None of the five headers should contain a version number.
Then re-run the audit to confirm the check passes.
curl -sIL https://example.com/ | grep -iE '^(server|x-powered-by|x-aspnet-version|x-aspnetmvc-version|x-generator):'
Platform-specific notes
WordPress
WordPress core does not send a version header; the leak is usually `X-Powered-By: PHP/8.x` or the web server's Server header. On managed hosts (Kinsta, WP Engine, SiteGround), ask support to disable `expose_php` and server tokens, or use the host's PHP settings panel. On Apache hosting, you can add `Header unset X-Powered-By` to `.htaccess`. As a fallback, create `wp-content/mu-plugins/hide-headers.php` containing `<?php header_remove('X-Powered-By');`.
Shopify
Shopify controls all response headers, and you cannot edit nginx or server config. Shopify storefronts typically return `Server: cloudflare` with no version, which passes. If the audit still flags a versioned header, it is coming from a proxy or CDN you placed in front of the store. Remove it there.
Next.js / Vercel
Next.js sends `X-Powered-By: Next.js` without a version, which passes, but set `poweredByHeader: false` in `next.config.js` anyway. On Vercel, the Server header is `Vercel` with no version. If you self-host behind nginx, apply `server_tokens off;` and `proxy_hide_header X-Powered-By;` there.
Cloudflare
Cloudflare replaces your origin's Server header with `cloudflare`, so the nginx/Apache version is already hidden from visitors. X-Powered-By and X-AspNet-Version still pass through, so remove them under **Rules > Transform Rules > Modify Response Header**.
Wix / Squarespace / Webflow
These hosted builders manage the server stack, and they do not expose software versions in homepage headers. There is nothing to configure. If a versioned header appears, check for a third-party proxy in front of the site.
Check that it worked
✅ How to verify
- Run `curl -sIL https://example.com/` and confirm that Server shows no version (e.g. `nginx`, `Apache`) and that X-Powered-By, X-AspNet-Version and X-AspNetMvc-Version are absent or version-free.
- In Chrome DevTools, open **Network**, reload the homepage, click the first document request and read the **Response Headers**.
- Run `sudo nginx -t` or `sudo apachectl configtest` to confirm the config is valid and was actually reloaded.
- Re-run the audit and confirm the check reports that no software versions are exposed.
⚠️ Common mistakes
- Putting `ServerTokens Prod` in `.htaccess`, where Apache ignores it. It must go in the main server or virtual-host config.
- Editing the config but never reloading nginx/Apache or restarting PHP-FPM, so the old headers keep being sent.
- Fixing only the origin server while a cache or CDN keeps serving stored responses with the old headers. Purge caches after the change.
- Treating header hiding as a security fix in itself. You still need to update the server software, because the vulnerability exists whether or not the version is visible.
Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.
Check my site freeFAQ
Is showing the server version a real security risk?
It is a low-severity information disclosure. It does not create a vulnerability, but it lets attackers and bots match your exact version to known CVEs without probing. Hiding it is cheap, and security scanners and compliance audits expect it.
How do I completely remove the Server header in nginx?
Stock nginx can only shorten it to `Server: nginx` using `server_tokens off;`. To remove it entirely, install the headers-more module and add `more_clear_headers Server;`, or strip it at your CDN. Removing the version is enough to pass this check.
Does hiding X-Powered-By break anything?
No. Browsers, search engines and applications do not rely on X-Powered-By, X-AspNet-Version or the Server version string. Removing them has no effect on site functionality or SEO.
Why does the audit still flag my site after I changed nginx.conf?
The most common causes are listed below. - **Nginx was not reloaded.** Run `sudo nginx -t && sudo systemctl reload nginx`. - **The directive is in the wrong place.** It must sit in the `http` block, or in a server block that actually serves the homepage. - **The header comes from another layer.** PHP, the application or a proxy may add its own header. - **A cached response is being served.** Purge your CDN and page cache.
How to Add Subresource Integrity (SRI) to CDN Scripts
How to Fix Vulnerable JavaScript Libraries on Your Site
How to Disable TLS 1.0 and 1.1 and Allow Only TLS 1.2+
How to Fix a Missing Permissions-Policy Header on Your Site
How to Enable TLS 1.3 on Your Web Server, CDN or Host
How to Fix Missing Clickjacking Protection (frame-ancestors)