I have a problem with a ubuntu-instance (Ubuntu 20.04.1 LTS) and apache2 (Apache/2.4.41 (Ubuntu)). One virtual-host is serving some html-files and documents from a mounted cifs-share. The cifs-share is working normally, files are correct on filesystem.
However, the apache fails to generate proper responses for every filetype which is served in binary (like images, word-documents, pdfs, ...). For example, when I download an image
image.gif the file is downloaded and saved to the client. When opening the file with a text-editor on the client it looks as followed:
grade, Keep-Alive Last-Modified: Thu, 12 Nov 2020 10:01:47 GMT ETag: "b6b-5b3e600040144" Accept-Ranges: bytes Content-Length: 2923 Keep-Alive: timeout=5, max=100 Content-Type: image/gif GIF89av[binary-string starting...]
So a part of the response-headers are now in the downloaded file, which should never happen. I am expecting the downloaded file starting with
GIF89av and so on. Serving text-based files (like html) is not a problem and works as expected.
However, when I copy the same file into the document-root of another virtual-host on the same server which does not use the mounted cifs-share, the file is served correctly (without response-headers in it).
So I assume, that there is some problem in this combination of mounted cifs-share and apache2, which leads to that error.
I already tried various options regarding the mount of the share - but that is correct in my opinion, since the files are working directly on the filesystem without apache.
The share is mounted in
/etc/fstab as followed
//192.168.0.1/share$ /mnt/share cifs username=user,password=pass,dom=contoso.local 0 0
which is pretty much the most basic way to do it. I experienced with options like
iocharset=utf8, tried different versions (
vers=3.1) but that didn't change anything. The apache-configuration is also the basic one, shipped with ubunutu 20, nothing special added or changed there. I experienced a bit with the mime-types, but apache should be cappable of serving an image out of the box.
Additionally I started a php-webserver (
php -S 192.168.0.2:8000) for testing in that directory - that returns correct binary-files which makes me pretty sure, that the error is somewhere in apache.
What is leading to this corrupt responses from apache and how can I fix it?