Apache won't serve images larger than ~2K

Posted by dtbaker on Server Fault See other posts from Server Fault or by dtbaker
Published on 2011-03-09T05:53:08Z Indexed on 2011/03/09 8:12 UTC
Read the original article Hit count: 333

Filed under:

Hello,

Just upgraded an old box to Ubuntu to 10.04.2 LTS. Apache will not display images to a browser that are over about 2K. Small images seem to display fine. Static HTML and PHP continues to works fine as well.

Installed:

apache2                                   2.2.14-5ubuntu8.4
apache2-mpm-prefork                       2.2.14-5ubuntu8.4
apache2-utils                             2.2.14-5ubuntu8.4
apache2.2-bin                             2.2.14-5ubuntu8.4
apache2.2-common                          2.2.14-5ubuntu8.4

here is an ngrep of an image that doesn't display fine in the browser:

T 192.168.0.4:32907 -> 192.168.0.54:80 [AP]
  GET /path/path/logo.png HTTP/1.1..Host: 192.1
  68.0.54..Connection: keep-alive..Accept: application/xml,application/xhtml+
  xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5..User-Ag
  ent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.13
   (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13..Accept-Enco
  ding: gzip,deflate,sdch..Accept-Language: en-US,en;q=0.8..Accept-
  Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3....                      

T 192.168.0.54:80 -> 192.168.0.4:32907 [A]
  HTTP/1.1 200 OK..Date: Wed, 09 Mar 2011 05:28:38 GMT..Server: Apa
  che/2.2.14 (Ubuntu)..Last-Modified: Tue, 05 Oct 2010 11:59:17 GMT
  ..ETag: "17b6f4-15fe-491dd63eb2f40"..Accept-Ranges: bytes..Conten
  t-Length: 5630..Keep-Alive: timeout=15, max=100..Connection: Keep
  -Alive..Content-Type: image/png.....PNG........IHDR...!...v......
  .%.....sRGB.........bKGD..............pHYs.................tIME..
  etc...

This looks ok to me!

I have tried firefox and chrome, both display small images fine but when a large image is requested the browser prompts to download the file.

When the image file is saved to the local computer it is corrupt, it also takes a long time to save which makes me think the browser cannot see the content-length header sent from apache. Also when I look at the saved image file it includes the headers from apache, along with a bit of garbage at the top, like so:

vi logo.png:

^@^UÅd^@$^]V^S^H^@E^@^Q,n!@^@@^F^@^@À¨^@6À¨^@^D^@P^Y¬rÇŹéw^P^@Ú^@^@^A^A^H
^@^GÝ^]^@pbSHTTP/1.1 200 OK^M
Date: Wed, 09 Mar 2011 04:47:04 GMT^M
Server: Apache/2.2.14 (Ubuntu)^M
Last-Modified: Tue, 05 Oct 2010 11:59:17 GMT^M
ETag: "17b6ff-157c-491dd63eb2f40"^M
Accept-Ranges: bytes^M
Content-Length: 5500^M
Keep-Alive: timeout=15, max=94^M
Connection: Keep-Alive^M
Content-Type: image/png^M
^M
PNG^M
etc...

Any ideas? It's driving me nuts.

There is nothing in apache error logs, and permissions are fine (because the image data is there, it's just somewhat corrupt).

There's no proxy or iptables on this ubuntu box either.

Thanks heaps!!

Dave

ps: just tried on IE from a different computer, same problem :( pps: rebooted server, no help.

© Server Fault or respective owner

Related posts about apache2