0

Seems that Apache insists on removing the "Content-Length" header when sending a response to a HEAD request.

Is there a way to configure it (or code it in PHP) to send "Content-Length: 0" for such responses?

For some weird reason it breaks the client (which is not under my control).

CodesInChaos
  • 106,488
  • 23
  • 218
  • 262

1 Answers1

0

One thing to look at would be mod_filter config. Look in modules/http/http_filters. Apache sends Content-Length by default, your host or environment may have disabled.

You might have better luck with this over at serverfault.

Community
  • 1
  • 1
Patrick Moore
  • 13,251
  • 5
  • 38
  • 63
  • Here's an answer at SF that might be fruitful: http://serverfault.com/questions/183843/content-length-not-sent-when-gzip-compression-enabled-in-apache – Patrick Moore Feb 05 '14 at 10:15
  • Thanks, I've seen this one. In my case according the HTTP 1.1, apache is correct and sending the content-length is not a MUST. However, even if I do send it in my code, apache removes it, and this is what I would like to change. – user3274651 Feb 05 '14 at 10:23
  • If your code is sending massive amounts of data, Apache is chunking it in response and therefore wouldn't include content-length. – Patrick Moore Feb 05 '14 at 10:26
  • I was talking about a response to a HEAD request, which has no content at all. – user3274651 Feb 05 '14 at 10:44