12

I need to minimize Apache HTTP response headers, by now i reduced them as following

HTTP/1.1 200 OK
Date: Thu, 25 Mar 2010 21:57:41 GMT
Server: Apache
Content-Type: text/html

I'd like to know if there is a way to disable Date and Server header, only for a certain virtual host.

Thank you!

3
  • Even Google respond with that header. Please don't remove it. A few bytes of bandwidth saved per request is the lowest priority in optimization.
    – Amy B
    Commented Mar 25, 2010 at 22:05
  • i totally agree with you, but i'm asking because i need this not for a web site but for a web service
    – Dario
    Commented Mar 25, 2010 at 22:07
  • I can not remove date header from golang net/http server too.
    – bronze man
    Commented Apr 2, 2019 at 2:20

1 Answer 1

6

The Date header is required at part of the HTTP standard. You can't remove it without being non-compliant with the http standard, so apache doesn't generally allow that.

6
  • Are you sure it's part of the HTTP standard? Where's the supporting article?
    – Pacerier
    Commented Mar 14, 2013 at 4:13
  • tools.ietf.org/html/rfc2616#section-14.18 - RFC 2616, section 14.18 "Origin servers MUST include a Date header field in all responses, except in these cases..."
    – dannysauer
    Commented Jul 12, 2016 at 20:04
  • @dannysauer This comment is factually correct, but misleading, because the following "except in these cases" paragraph includes "If the server does not have a clock that can provide a reasonable approximation of the current time". So server admins are allowed to omit the Date header at their leisure as long as they feel, that it "can not provide a reasonable approximation of the current time". Commented Feb 7, 2018 at 5:45
  • No, it's not misleading at all. In the context of the question asked, one virtual host on the same server is exceptionally unlikely to be unable to provide a reasonable approximation of the current time. This isn't a court of law; it's the internet - where things work together because most people work in good faith to follow the intent of the RFCs. Reading the rest of that exception, it's plain to see that the authors were referring to servers without a clock. That's why 14.18.1 is titled "clockless servers". :)
    – dannysauer
    Commented Feb 7, 2018 at 12:03
  • Can we change the timezone instead of GMT ?
    – ideeps
    Commented Mar 20, 2019 at 4:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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