LESS BANNER, MORE PATCHING

Server and X-Powered-By headers: how to hide version disclosure on nginx, Apache, PHP and IIS, and why patching matters more

Server and X-Powered-By headers often tell every visitor which web server, language and framework you run, sometimes down to the exact version. That detail does not create a vulnerability, but it makes known ones easier to match. This guide shows how to remove or generalize these headers on common stacks, how to check the result, and why a patched server matters far more than a quiet one.

Concept illustration of an ivory ceramic parcel on a charcoal surface; a small copper burnishing tool polishes its translucent glass shipping tag blank, while a soft mint glow inside the parcel shows its contents are intact.
Concept illustration

Open the response headers of almost any website and you will find a line such as Server: nginx/1.24.0 or X-Powered-By: PHP/8.1.2. Web servers, language runtimes and frameworks add these headers by default, so most sites announce their software stack, and often the exact version, to every visitor and every automated scanner.

That announcement is not a vulnerability in itself. It does, however, save an attacker time: a precise version string can be matched against public vulnerability databases in seconds. The HTTP specification itself advises servers not to send needlessly fine-grained detail in the Server header, and the OWASP HTTP Headers Cheat Sheet recommends removing X-Powered-By or giving it a non-informative value.

This guide explains what these headers reveal, how to remove or generalize them on nginx, Apache httpd, PHP, Node.js and IIS, how to verify the change across all your responses, and why keeping that software patched matters far more than hiding its name. All examples use example.com; run the checks only against sites you own or manage.

Scope of this guide

This guide covers what your own public responses reveal: headers, error pages and page markup. Hiding versions does not fix vulnerabilities. Sitelemetry reads public responses passively, cannot see your patch level or internal hosts, and is not a pentest.

1. What Server and X-Powered-By headers reveal

The Server header is defined in RFC 9110. It describes the software the origin server uses to handle the request, as one or more product tokens with optional versions and comments. X-Powered-By is not in any standard: it is a convention that runtimes and frameworks such as PHP, ASP.NET and Express use to advertise themselves. Neither header is needed for a browser to display your page; browsers ignore both.

Here is what typical values tell a visitor:

Header as observedWhat it revealsUsually added by
Server: nginxWeb server product onlynginx with server_tokens off
Server: nginx/1.24.0Product and exact versionnginx default configuration
Server: Apache/2.4.57 (Debian) OpenSSL/3.0.11Server version, operating system family and TLS library versionApache httpd with ServerTokens Full or similar
X-Powered-By: PHP/8.1.2Language runtime and versionPHP with expose_php = On
X-Powered-By: ExpressNode.js frameworkExpress default
X-Powered-By: ASP.NET and X-AspNet-Version: 4.0.30319Microsoft stack and .NET runtime versionIIS and ASP.NET defaults

The same information also leaks through other channels: default error pages that print a version in their footer, a <meta name="generator"> tag added by a CMS, framework-specific cookie names, and paths to well-known assets. Section 8 covers those.

2. Why version disclosure helps attackers, and what it does not do

Most attacks against websites are not crafted by hand. Automated tools sweep large address ranges, read banners, and compare product versions with lists of known vulnerabilities (CVEs). A header that says Apache/2.4.49 lets such a tool decide in one request that your server is worth a closer look. RFC 9110 says this directly: overly detailed Server values may reveal internal implementation details that make it slightly easier for attackers to find and exploit known security holes, and an origin server should not send needlessly fine-grained detail.

The OWASP Web Security Testing Guide treats web server fingerprinting as one of the first information-gathering steps for the same reason. Knowing the stack narrows the search: which CVEs to research, which default file paths to try, and where an admin panel is likely to live.

Keep the effect in proportion, though:

  • Disclosure does not make a server vulnerable. A fully patched server with a version banner is safer than an outdated one without.
  • Hiding the banner does not stop fingerprinting. Header order, error page wording, TLS behaviour and response quirks can still identify the software. Many scanners simply try known exploits regardless of what the banner says.
  • The benefit is noise reduction. Removing versions takes your site out of the cheapest, banner-driven matching, removes an easy entry from reconnaissance and stops advertising exactly when you fall behind on an update.

That is why audit tools, including Sitelemetry, rate this as low or informational rather than urgent.

3. Patching matters more than hiding

Treat the version header as a reminder, not the problem. If a banner shows a version that is several releases old, the real task is updating that component; removing the header only hides the symptom from you as well as from others.

A practical order of work:

  1. Inventory the stack. Record the web server, reverse proxy, CDN, language runtime, framework, CMS and plugins for each site, with versions. Ironically, the disclosing headers are a quick way to start this list before you remove them.
  2. Check support status. Confirm each version is still supported by its maintainer or your operating system vendor. Unsupported runtimes no longer receive security fixes.
  3. Subscribe to advisories. Follow the security announcements of nginx, Apache httpd, PHP, Node.js, your CMS and your Linux distribution.
  4. Patch on a schedule. Apply security updates routinely, with a faster path for critical issues.
  5. Then reduce disclosure. Remove or generalize the headers as described below.

One edge case is worth knowing. Linux distributions such as Debian, Ubuntu and Red Hat often backport security fixes into the package version they ship, so a banner like Apache/2.4.57 (Debian) may be fully patched even though upstream has moved on. The banner is therefore unreliable in both directions: it can make a patched server look outdated, and it never confirms that a server is patched. Check the package changelog or your vendor's security tracker, not the header.

4. nginx: server_tokens and proxied headers

By default nginx sends Server: nginx/ followed by its version and prints the version on its built-in error pages. The server_tokens directive in the core module controls both. Set it once in the http block so it applies to every virtual host:

http {
    server_tokens off;
    # ...
}

Test and reload:

sudo nginx -t && sudo systemctl reload nginx

The header becomes Server: nginx and error pages no longer show a version. Removing the product name entirely is a separate step:

  • In the commercial NGINX Plus, server_tokens also accepts a string, and an empty string disables the Server field.
  • In open-source nginx, the usual option is the third-party headers-more module (more_clear_headers Server;), which must be compiled in or installed as a dynamic module. For most sites, the product name without a version is an acceptable result.

When nginx is a reverse proxy, also look at what the upstream application sends. nginx does not pass the upstream Server header by default, but it does pass X-Powered-By. Strip it with the directive matching your setup:

location / {
    proxy_pass http://127.0.0.1:3000;
    proxy_hide_header X-Powered-By;
}

location ~ \.php$ {
    fastcgi_pass unix:/run/php/php-fpm.sock;
    fastcgi_hide_header X-Powered-By;
}

Fixing it at the source, as shown in section 6, is cleaner because the header then disappears on every path, including those that bypass this nginx instance.

5. Apache httpd: ServerTokens and ServerSignature

Apache uses two core directives. ServerTokens controls the Server header, and ServerSignature controls the footer line on server-generated pages such as directory listings and error documents.

ServerTokens Prod
ServerSignature Off

ServerTokens Prod reduces the header to Server: Apache. The directive applies to the whole server and cannot be set per virtual host, so put it in the main configuration. On Debian and Ubuntu the shipped file is /etc/apache2/conf-available/security.conf, enabled by default, which already contains both directives with less strict values; edit them there rather than adding duplicates elsewhere. On Red Hat-based systems, add them to the main httpd.conf or a file in conf.d. Then check and reload:

sudo apachectl configtest && sudo systemctl reload apache2

(The service is called httpd on Red Hat-based systems.)

Two limits to know:

  • The product name stays. Core Apache offers no setting that removes Server: Apache, and Header unset Server in mod_headers does not remove the header Apache adds itself.
  • X-Powered-By comes from the application. If PHP or another backend adds it, turn it off there. As a fallback, mod_headers can remove it; because headers can be stored in two internal tables depending on how they were added, the Apache documentation suggests using both forms when one does not work:
Header unset X-Powered-By
Header always unset X-Powered-By

6. PHP, Express, Next.js and other application headers

PHP

PHP adds X-Powered-By: PHP/ plus its version when expose_php is on, which is the default in many builds. The setting can only be changed in php.ini or server-level configuration, not with ini_set() in code:

expose_php = Off

Make sure you edit the file the web server actually uses. The CLI and PHP-FPM often load different files; php --ini shows the CLI one, and a temporary phpinfo() page (removed straight after) shows the loaded configuration file for FPM. Restart PHP-FPM, or Apache when using mod_php, after the change.

Note that PHP can still be recognized without a version, for example from a PHPSESSID session cookie or .php URLs. That is normal and low value to an attacker; renaming the session cookie with session.name is optional.

Node.js

Express sends X-Powered-By: Express unless you turn it off, and its security best practices recommend doing so:

const app = express();
app.disable('x-powered-by');

The Helmet middleware removes the header as well. Next.js adds X-Powered-By: Next.js by default; set poweredByHeader: false in next.config.js.

Other platforms

Check your framework documentation for similar switches. Common extra headers include X-Generator, X-Drupal-Cache, X-AspNetMvc-Version and version-bearing Via values from proxies. Remove what you do not need for operations or debugging.

7. IIS and ASP.NET

A default IIS site with ASP.NET can send three disclosing headers: Server: Microsoft-IIS/10.0, X-Powered-By: ASP.NET and X-AspNet-Version. Each needs its own setting.

HeaderSettingWhere
ServerremoveServerHeader="true" on requestFilteringIIS 10.0 version 1709 and later
X-Powered-By<remove name="X-Powered-By" /> under customHeadersSite web.config or server level
X-AspNet-VersionenableVersionHeader="false" on httpRuntimeASP.NET (.NET Framework) web.config
Server: KestrelAddServerHeader = false in Kestrel server optionsASP.NET Core application code

A combined web.config for an IIS site:

<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>

The removeServerHeader attribute is documented in the IIS request filtering reference. On older IIS versions it is not available, and the usual alternatives are a URL Rewrite outbound rule that blanks the value or a module that clears it; an outbound rewrite typically leaves an empty Server header rather than removing it. If an older IIS release is still in service, upgrading it matters more than any header rule.

8. Beyond headers: meta generator tags, error pages and CDNs

Headers are only one source. A complete cleanup looks at every place your stack names itself:

  • Generator meta tags. Many CMSs add <meta name="generator" content="..."> with a version. In WordPress, remove_action('wp_head', 'wp_generator'); in a theme or small plugin removes it; other CMSs have a setting or template change. Version query strings on static assets can leak the same detail.
  • Error pages. Default 404, 500 and 502 pages from the server, the proxy or the framework often print product names and versions, and debug modes print stack traces. Serve custom, plain error pages and keep debug output off in production.
  • Admin and default paths. Well-known login and readme files confirm the platform. Restrict admin areas by network or strong authentication instead of relying on obscurity.
  • CDNs and hosting platforms. A CDN or managed platform often replaces your Server header with its own name, such as the CDN product. You usually cannot change that, and a provider name without a version reveals little about your origin. Check that the origin's own headers are clean too, because anyone who reaches the origin directly sees them.

Remember that some disclosure is unavoidable and harmless: a site built on a popular CMS will always be recognizable. The goal is to avoid advertising exact versions, not to make the stack impossible to identify.

9. How to verify the fix

Check several kinds of response, not just the home page, because different layers produce them:

# home page
curl -sS -D - -o /dev/null https://example.com/

# a missing page (server or framework error handler)
curl -sS -D - -o /dev/null https://example.com/this-page-does-not-exist

# a static file and an API route, if you have them
curl -sS -D - -o /dev/null https://example.com/favicon.ico
curl -sS -D - -o /dev/null https://example.com/api/health

# the plain HTTP redirect
curl -sS -D - -o /dev/null http://example.com/

On Windows, call curl.exe and use -o NUL. To filter the output, append | grep -iE '^(server|x-powered-by|x-aspnet)' on Linux or macOS. Use GET as shown rather than curl -I: some applications handle HEAD requests through a different path and send different headers.

For error pages, also open the 404 URL in a browser and read the footer. To look for generator tags, fetch the HTML and search it:

curl -sS https://example.com/ | grep -i 'name="generator"'

If a header persists, find which layer adds it. Request the origin directly from a host that is allowed to reach it, then through each proxy in turn; the layer where the header first appears is the one to configure. Watch for caches serving responses stored before your change, and repeat the check after server, runtime or CMS upgrades, because packages sometimes restore default configuration files.

10. What Sitelemetry checks

Two passive Sitelemetry security modules report this topic. Both run in every scan profile and are included in every plan (Free at $0, Starter at $49/month, Professional at $149/month, Enterprise at $249/month). They read only what any visitor receives, so they need no ownership verification on their own: the free Launch Readiness Snapshot runs them without signup, and a Free-plan security audit runs them even before you verify the site. A security audit that also includes checks that need ownership proof, as paid-plan audits do by default, asks you to verify the site first. Both request the home page (root URL) of the scanned origin and follow redirects.

  • http.header.server.disclosure (HTTP headers module) is reported when the final home page response carries a Server or X-Powered-By header. The evidence lists the observed values, for example server: nginx/1.24.0; x-powered-by: PHP/8.1.2.
  • tech.fingerprint.disclosure (technology fingerprint module) sends one GET request and collects technology signals from response headers (Server, X-Powered-By, X-AspNet-Version, X-AspNetMvc-Version, X-Generator and Via), from the first 32 KB of the page (a generator meta tag, versioned jQuery, Bootstrap or AngularJS files and framework signatures) and from cookie names. The evidence shows up to ten signals, and the finding carries medium confidence.

Both findings use the same rating logic:

What is observedSeverity
Product or framework name without a version, such as Server: nginxInformational
Any version string, such as Server: nginx/1.24.0Low
Any X-Powered-By, X-AspNet-Version or X-AspNetMvc-Version headerLow
No disclosing header or signalNo finding

A library version in a script URL counts as a version too, so tech.fingerprint.disclosure can stay Low after your headers are clean. Keeping the library current matters more than hiding its version.

Some limits are built in. The fingerprint module only assesses a 2xx response: if it receives an error status, no response or a bot-protection challenge page, it marks the check inconclusive and reports no disclosure, because a challenge page shows the protection layer rather than your site. The headers module likewise reports a bot challenge, access denial or edge error page as not measured. PHP that is detected but hides its version is kept as an informational signal outside the disclosure finding, so it cannot change your score. Neither module can see your patch level, backported fixes or software on other hosts.

For the other headers on the same response, try the free security headers checker or read the security headers check guide and the guide to TLS and security headers. The website launch security checklist includes technology disclosure among its pre-launch checks, the website security audit guide explains how these findings fit into the full set of security checks, and pricing lists what each plan adds.

Common questions

How do I remove the X-Powered-By header?

Turn it off where it is created. For PHP set expose_php = Off in the php.ini used by PHP-FPM or Apache and restart it; in Express call app.disable('x-powered-by'); in Next.js set poweredByHeader: false; in IIS add a remove entry for X-Powered-By under customHeaders. As a fallback, nginx can strip it with proxy_hide_header or fastcgi_hide_header, and Apache with Header unset.

How do I hide the nginx version?

Add server_tokens off; to the http block of your nginx configuration, test it with nginx -t and reload. The header becomes Server: nginx and error pages stop showing the version. Removing the product name entirely needs NGINX Plus or the third-party headers-more module, which most sites do not need.

Is showing the server version a security vulnerability?

Not by itself. It is information disclosure that makes known vulnerabilities easier to match, which is why it is usually rated low or informational. An outdated, unpatched component is the real risk, whether or not its version is visible.

Will hiding version headers protect an outdated server?

No. Attackers can fingerprint servers in other ways, and many automated tools try known exploits without reading banners at all. Hiding versions reduces noise and casual targeting; only updating the software removes the vulnerability.

Why does my site still show a Server header after I changed the configuration?

Another layer may be adding it, such as a CDN, load balancer or hosting platform, or a cache may be serving older responses. Compare the origin with each proxy to find the layer that adds it. A CDN name without a version reveals little and is often outside your control.

Sources & further reading

  1. RFC 9110: HTTP Semantics (Server header field)www.rfc-editor.org
  2. MDN: Server headerdeveloper.mozilla.org
  3. OWASP HTTP Headers Cheat Sheetcheatsheetseries.owasp.org
  4. OWASP Web Security Testing Guideowasp.org
  5. nginx: ngx_http_core_module (server_tokens)nginx.org
  6. Apache HTTP Server: core features (ServerTokens, ServerSignature)httpd.apache.org
  7. PHP manual: php.ini core directives (expose_php)www.php.net
  8. Microsoft Learn: IIS Request Filtering (removeServerHeader)learn.microsoft.com
Sitelemetry team

Prepared by the Sitelemetry editorial team. Explore the linked sources for further detail.

SITELEMETRY

Put what you learned to work.

Explore your website’s structure, settings and signals with Sitelemetry.