Score:0

Apache sends garbage response when requesting a .jpg

ru flag

I am running Apache/2.4.38 (Raspbian). When requesting HTML and PHP everything works fine. When I request a .jpg file, apache seems to skip a few bytes at the beginning of the response header, and some garbage is included at the end of the payload.

Specifically, after GET /images/2.jpg HTTP/1.1 the response looks like:

21 19:00:13 GMT
ETag: "23fa-5cf6e52077278"
Accept-Ranges: bytes
Content-Length: 9210
Keep-Alive: timeout=5, max=97
Connection: Keep-Alive
Content-Type: image/jpeg

Previous responses within the same session looked correct like:

HTTP/1.1 200 OK
Date: Mon, 01 Nov 2021 19:08:49 GMT
Server: Apache/2.4.38 (Raspbian)
...

This only happens for JPEG images. The image file itself is okay, I can view it with gwenview. The same faulty response is sent whether I try with chrome, with wget, or even manually with netcat. Always the same faulty response.

How can that happen, and how can I fix it?

phili_b avatar
sn flag
Yes the issue was only for images but not for text files. You should have « accept » the answer below if it worked for you.
Score:0
cn flag

I found the answer after searching specifically for "apache jpeg cifs share". It is a known bug caused my mmap not working on files on a CIFS share. Solution is to set EnableMMAP off in the apache configuration for all folders on CIFS shares.

phili_b avatar
sn flag
Thanks for the explanation about CIFS and not only `EnableMMAP off`: a cifs disk partition mounted was exactly my cause on Ubuntu.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.