Remove framework version headers on nginx
Why it matters
Headers such as X-AspNet-Version, X-AspNetMvc-Version and X-Generator name the exact framework release, which tells attackers which known vulnerabilities to try. Browsers never need them.
The fix
- Hide the headers from the backend in the http or server block, run sudo nginx -t and reload. Use proxy_hide_header for proxied applications and fastcgi_hide_header for PHP-FPM.
- A location with proxy_hide_header or fastcgi_hide_header lines of its own does not inherit the server-level ones, so repeat these lines there.
nginx
proxy_hide_header X-AspNet-Version; proxy_hide_header X-AspNetMvc-Version; fastcgi_hide_header X-Generator;
Related
Scan your domain to see whether this applies to you.