Apache Sending "Content-Length : 0" , How to Fix?

6,812

X-Sendfile header won't be sent by apache, so probably you haven't enabled xsendfile in that virtual host. When XSendFile is enabled, apache will be remove X-SendFile header and will sent the file.

Share:
6,812

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin over 1 year

    I am using Apache server and it is sending Content-Length = 0 value which is preventing file-downloads, see - http://www.youtubedroid.com/download2.php?v=_3XcMEKNws0&title=Akhila+%2CMumbai+reloaded%2CSuper+dancer+2&hq=0 , here are my .htaccess content :

    SetEnv no-gzip dont-vary
    

    Here are headers sent by the server :

    HTTP/1.1 200 OK
    Date: Tue, 15 Dec 2009 06:12:11 GMT
    Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
    X-Powered-By: PHP/5.2.11
    Content-Description: File Transfer
    Content-Disposition: attachment; filename="Akhila ,Mumbai reloaded,Super dancer 2.mp3"
    Content-Transfer-Encoding: binary
    Expires: 0
    Cache-Control: must-revalidate, post-check=0, pre-check=0
    Pragma: public
    X-Sendfile: ./tmp/64eb3b185e38af95c15405ffb0606e76.mp3
    Content-Length: 0
    Keep-Alive: timeout=5, max=95
    Connection: Keep-Alive
    Content-Type: application/octet-stream
    

    Pls. tell how to fix this ?

    • Vineet Kasat
      Vineet Kasat over 14 years
      Please phrase your question in the form of a question.
    • Admin
      Admin over 14 years
      Michael - I hope it's better now :)
    • Vineet Kasat
      Vineet Kasat over 14 years
      My guess is that this is a programming issue. The download2.php script is responsible for setting the length and such. I see you are using sendfile() or its like, which, so long as it can read the file, should "just work."
    • PP.
      PP. over 14 years
      I would suspect your script is outputting nothing. Triple check your PHP script.