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?