The X-Powered-By response header is frequently used by web applications and frameworks to identify the underlying technology generating a website's responses. For instance, you might see X-Powered-By: Express in the headers from a Node.js application running Express. While it may seem harmless, exposing the framework version or server-side technology can pose a security risk by offering potential attackers a clearer view of your environment.
At its core, X-Powered-By is a non-standard response header that announces the technology stack behind your website. This might include the programming language, the web framework, or even the specific version of your application server. While originally intended for debugging or branding, this header often gives away more information than you might want to share.
If a hacker knows you're using a particular version of a framework with a known vulnerability, they can attempt to exploit it directly.
Many automated scanners identify systems based on headers like X-Powered-By. Removing or obscuring this header can reduce the effectiveness of these scripts.
When a user visits a website, the server responds with HTTP headers that provide metadata about the response. While most headers (such as Content-Type) are standardized, X-Powered-By is merely an optional or custom header. It's often automatically set by the server framework.
<IfModule mod_headers.c>
Header unset X-Powered-By
</IfModule>
Place this code in your .htaccess file at the root of your website. Make sure mod_headers is enabled in your Apache configuration.
server {
listen 80;
server_name example.com;
location / {
proxy_hide_header X-Powered-By;
}
}
Add this configuration to your server block in nginx.conf or your site-specific configuration file.
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
Add this configuration to your web.config file in the root of your web application.
Removing or altering X-Powered-By is not a catch-all solution for server hardening; it's a simple measure that forms part of a broader security posture. By eliminating headers that give away details about your underlying environment, you reduce your site's attack surface and make it less attractive to opportunistic attackers.
Combine this step with other security best practices—such as regular patching, enforcing strong authentication, and performing security scans—to maintain a resilient web application infrastructure.
Learn about other HTTP security headers to strengthen your website's security: