HACKER Q&A
📣 secondcoming

What would break if I dropped the Date header


Following on from [0], I'm curious as to what would break if my web server stopped sending the HTTP Date header. In scenarios where 204's are a common response, this header can make up much of the payload and may be a waste of CPU too.

[0] https://news.ycombinator.com/item?id=33266471


  👤 LinuxBender Accepted Answer ✓
Here is what "Date" is used for [1][2] if that helps you decide what impact it will have on your site. FWIW I have removed it before but I also don't care about search engines. As for wasting CPU, the date is already fetched by the server used for logging each request even if logging is disabled. Excluding the header will reduce the header size but unlikely improve CPU load of the server. If the goal is a reduction of server load related to headers, then telling the web server daemon to not generate ETag's will have a more significant effect and also impact search engines, proxies and CDN's

An origin server MUST NOT send a Date header field if it does not have a clock capable of providing a reasonable approximation of the current instance in Coordinated Universal Time. An origin server MAY send a Date header field if the response is in the 1xx (Informational) or 5xx (Server Error) class of status codes. An origin server MUST send a Date header field in all other cases.

So one could make the argument that if one choose to not have the correct time on their server then one must not send Date.

[Edit] I should that that FWIW if one wanted to tinker with time, one could change the system clock and/or recompile the web daemon to call time differently but this is a whole can of worms in and of itself. [3]

[1] - https://stackoverflow.com/questions/1610254/whats-the-ration...

[2] - https://stackoverflow.com/questions/4726515/what-http-respon...

[3] - https://blog.packagecloud.io/system-calls-are-much-slower-on...