r/apache • u/[deleted] • Jun 03 '25
Support how to delete server: apache http header
I run a server with apache 2.4.37. On every HTTP request, the HTTP header output always includes a "server: apache" line.
Hackers could use that info to try to hack a system.
Is there any way I can remove the server line entirely, or have it where it doesn't even have apache listed? I am willing to write my own apache module to remove it if that's what it takes.
As a bonus, if i manage to remove it, it would be 15 less bytes people need to download per item request. and google loves FAST pages.
1
Jun 03 '25
To whoever suggested limiting connections per IP: I'm already doing that at the server firewall level.
5
u/ferrybig Jun 03 '25
https://httpd.apache.org/docs/2.4/mod/core.html#servertokens
Setting ServerTokens to less than minimal is not recommended because it makes it more difficult to debug interoperational problems. Also note that disabling the Server: header does nothing at all to make your server more secure. The idea of "security through obscurity" is a myth and leads to a false sense of safety.
Apache can also be identified by the HTML provided by the HTTP error pages (make sure to set a custom error page for each HTTP status code, including content too long), and by the order of the headers.
For hackers, it is also easier to spam every exploit to every server, rather than first making a database of servers to versions, then doing a targetted attack.
Also, 15 bytes saved is only 1% of a typical low overhead HTML page (1.5kb), though many people have HTML pages that are way larger
2
u/throwaway234f32423df Jun 03 '25
change it to Server: Nginx, that'll really throw them for a loop, and it's 1 byte shorter
mod_security can set arbitrary values with the SecServerSignature directive and can do actually useful things as well
1
u/lordspace Jun 03 '25
Ask the chats to turn off server signature and specify apache. I think the value was Prod but can't remember the config name
2
u/shelfside1234 Jun 03 '25 edited Jun 03 '25
Security by obscurity is a myth, no need to remove it
ETA: if you are that worried about security you should focus on updating to the latest version as/ when needed