I have been going crazy trying to remove response headers from my Apache2 server. I have mod_headers enabled and I have 'Header unset BLAH_HEADER_NAME' in my apache2.conf file, but it doesn't appear to be working, though 'Header append' appears to work..go figure.

I've read that mod_perl might work, but I don't have any experience doing this..any ideas. I also read that 'Header unset' might be bugged, is this confirmed.

  • Which header are you trying to modify? Nov 8 '11 at 19:34
  • i'm trying to remove: Header unset Content-Length Header unset Keep-Alive Header unset Content-Type Header unset Server Nov 8 '11 at 19:39
  • i have ServerTokens Prod and ServerSignature Off, so in my Header unset Server, i'm just trying to remove the whole header in the response. i was given specs to have a minimalist response header to lighten the responses. Nov 8 '11 at 19:52

I can't really imagine why you'd want to unset all of those, breaking your compliance with the HTTP/1.1 standard.. but, Server cannot be unset (see here), while the others ought to work; try:

Header always unset Content-Length
Header onsuccess unset Content-Length
  • this actually didn't work this is what i have in my apache2.conf on ubuntu 11.10 <IfModule mod_headers.c> Header always unset Content-Length Header onsuccess unset Content-Length Header always unset Keep-Alive Header always unset Content-Type Header onsuccess unset Content-Type </IfModule> i definitely appreciate the help!! Nov 8 '11 at 20:10
  • this addition is at the bottom of my conf file after everything is loaded..fyi. Nov 8 '11 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.