Just upgraded my server from 15.0 to 15.1, and Apache2-served images are no longer appearing in a browser on the LAN (Firefox on Linux/Win10 or Chrome on Android) using local IP of server, or external URL, all of which worked fine on 15.0 and earlier). HTTP/PHP etc content (and locally cached images) appears normally - its just the (non-cached) images (png/jpg) not appearing. However, on the server itself using ‘localhost’, its own IP or local server name alias, images are displayed normally (Firefox), suggesting that Apache itself is working. No Apache config files seem to have been touched by the upgrade; there are no relevant entries in error_log and access_log just shows normal GET. The firewall (firewalld) is disabled (but why should this block just images anyway?). Could there be a faulty mime or some other (new/changed) component in 15.1 which is blocking images apparently served ok by Apache but not getting ‘out of the box’?
Depending on your virtual webserver configuration, localshost can be a misleading and incorrect test/deployment…
loclhost is a network interface which is different than your “external” network interface assigned the address other machines use to contact your server.
Run your tests again using your LAN address, not localhost.
That’s assuming of course that you aren’t deployed using http headers since your localhost test works (assuming you don’t have a defined “localhost” http header).
It’s a bit curious if text in the pages are served but not images… that might provide a clue but might also depend on the website technology you’re using (HTML? PHP? something else?)
TSU
Hi tsu - thx for quick reply.
I appreciate that localhost is somewhat special, but I did mention in my first post that using the local (LAN) server IP address on the server worked too. But using the same IP on my (OpenSUSE Tumbleweed) laptop or android device on the LAN all fail to show images. On the server (LAN IP 192.168.1.4,) I created a simple ‘hello world’ test with one <img> tag to a sample jpg with both in the Apache root (/srv/www/htdocs).
> cat test.html
<html><body><h1>It works!</h1>
Image: <img src="image.png">
</body></html>
So: on the server: http://192.168.1.4/test.html shows the text & image, **on the laptop **http://192.168.1.4/test.html shows only the text, with an image placeholder.
From external WAN,/Internet http://82.69.82.225/test.html should show the non-image test page. BTW, even on the server, if this public IP is used (as is the case for the real web pages), the image is again missing.
(Also see http://chudleighweather.info; there should be a set of temperature, humidity, wind etc images updated every minute or so, but these will be missing too (as is the background image), but the current obs as text will be rendered in the table. This page is pure html apart from some JS functions to control the date links.)
At this point, I can’t say that image files are the only missing items, but they are the most obvious ones that worked perfectly in 15.0. Had the html not been rendered, I’d at least have some ideas where to look…
How did you deploy your website, and do you have anything installed in front of your website like an apache proxy server?
Is the most common issue when I do an Internet search on your error… as the error says (err_content_length_mismatch),
There is a difference between what your server is serving compared to what your browser is receiving
https://www.google.com/search?q=ERR_CONTENT_LENGTH_MISMATCH+apache
TSU
No proxy, nothing but the Apache2 setup serving port 80. The router/modem port-forwards WAN requests on port 80 straight to the server’s (fixed) LAN IP. But that’s not relevant for internal LAN connections.
I’ve not seen that message (or any other errors whether in a browser, Apache logs or system journal) and it’s not clear to me where it occurs (in the local client browser?) None of the Googled articles seem relevant for my pretty simple setup, and none suggest a likely cause or offer a fix.
The fact remains that this morning all worked normally under OpenSUSE LEAP 15.0, and not this afternoon under 15.1. Only the server has been upgraded (the last laptopp Tumblweed update was yesterday; android devices longer ago.) The ‘fault’ strongly suggests something is broken in 15.1 or at least some significant change somewhere between the Apache2 system and the eth0 interface.
And yes, I have rebooted everything!!
Ever figure out what’s happening here? I’ve run into the same problem. Didn’t have apache installed before 15.1, so can’t narrow it down to that, but err_content_length_mismatch on all images and some other assets (jquery, css) when viewed over LAN on anything but localhost. Tried slightly different versions of apache, two different websites on that apache server (including a standard wordpress.org install), don’t have the issue with Tomcat and Docker installations on the same machine. Driving me nuts.
Years ago I had it where my server worked but nothing else saw the images -
It turned out that the images had only the user on the server permission and not anyone else - by changes the permissions to 644 on the images and making sure that apache was in the users group - that allowed everyone to see the image.
Not sure if that is your problem. I have been thru 7 upgrades of OS and apache and no problems with my website on any update.
While I agree that a mismatch between the user that owns the Apache processes and the permission of the files to be servred can create problems (like every mismatch between those properties for every action, after all users and permissions are for security), this is a bit vague. There is e.g. no user “apache” on a default installation (the apache process are owned by wwwrun).
When you in fact mean user wwwrun, then it is also in general not a good idea to have this user added to the group users. This would allow wwwrun a lot of permissions on a lot of files owned by a lot of users without them probably realizing that that is the case.
On the contrary, to allow wwwrun read permission to (and thus Apache to serve) files (being images or otherwise), you could make:
- those files to be owned by wwwrun
; - or (better imo) make those files to be owned by another user, created for the purpose, and that user then also shoudl have the same primary group as wwwrun
, which is www; then of course that user should give read permission of his files to the goup, so that wwwrun (and thus the Apache server) can read them). - for any files owned by others, those others must set read permission for the world (others) so that wwwrun
processes (Apache server) can read them.
All three methods above have as a starting point that file owners should grant permission to the server processes, instead of your solution that allows permissions to a user wwwrun far beyond what it needs on files of innocent and unknowing owners (I would rate this as misuse of root’s power).
BTW the second suggestion above has the further advantage that you now have a user dedicated to manage the web site contents. No root needed for that (which is something I hope you already did not do), but also no mixing of web site management with that of a “normal” users (who does use bank accounts, mail, whatever). Maybe the same person (like root and probably one of the users are the same pwrson), but different tasks, thus different users.
At least in the @OP post,
The image was served from the root directory, the same as the html text document, so although it’s possible, it’s unlikely that permissions would have been in an issue in that case (run ls -l to be sure).
And of course that situation eliminate possible issues related to virtual paths/directories.
It’s a curious situation I haven’t personally run into before.
TSU
Same here. I concur with you that a thourough check of all permissions inside the root directory is the only thing I can advise at the moment.
Please compare output from both systems of the command below:
sudo a2enmod -l
As OP, here’s where I’m at (basically given up on Apache)
- Confirmed the OpenSUSE 15.0->15.1 u/g made no changes to any Apache config files (diff of ‘live’ vs. pre-upgrade system backup)
- All images continued to be owned by www:wwrun and have correct permissions (i.e. no changes here either)
- Investigated HTTP headers on laptop when accessing an image by direct URL (http://<serverIP>/image.jpg). This confirmed that Apache was reading and reporting the correct file size, but zero bytes of it being received, so local browser reports ‘truncated file’ error. Something, somewhere is not allowing the image file to transfer over the LAN, although fine when run on ‘localhost’ server.
- Installed the (then) latest version of Apache from the official website replacing the 15.1 repo version (and same version as in Tumbleweed repo at that time). No change, images still not displayed
- Stopped Apache server & ran Python SimpleHTTP server on default port 80 - success! Images displayed normally
- Installed Nginx with default config - success! Images displayed normally.
The above rules out any non-Apache image ‘filter’ (whether some other OpenSUSE server component or LAN (router, laptop, etc), as other webservers work fine. Then again, a different (later - not attempted to roll back to the 15.0 version - and same as working under Tumbleweed) Apache does not cure the problem. My conclusion is that there is some interaction between Apache and 15.1 which may or may not be solved by a later (future) upgrade. As such, it’s beyond my expertise to delve deeper, and since Nginx works fine, I’ve now abandoned Apache and set up Nginx to do (almost) all that Apache did to serve content.
I might retry Apache when OpenSUSE Leap 15.2 is released (mid 2020??), but for now, Nginx does the job.
It is a pitty we can not help you n this strange case.
Just for your information.
Last week I updated from 15.0 to 15.1 (using the change repos and then do zypper ref > zypper dup way of updating).
I have Apache running and connecting both from the same system to localhost as well as from another sytem on the same LAN. I have no problems getting the images shown in the pages by either FF or Konqueror as client.
That does not realy help you, but it is an indication that it is not a general problem with the openSUSE 15.1 and Apache combination.
I spoke too soon. I can not get anything from the other system on the LAN. >:)
Apparently I did skipp this test after the upgrade of the server system.
OK,seems you may have a similar issue (OK on ‘localhost’, no images on another machine on the LAN). At least I may not be unique and >1 implies many more - perhaps unreported, though not necessarily universal.
The difference between you and me is that I got “nothing” and yout only di not get your images.
But I got mine working.
I changed the Listen statment in /etc/apache2/listen.conf
There was
Listen 80
And that resulted in
boven:~ # netstat -tulp | grep htt
tcp6 0 0 ::]:www-http ::]:* LISTEN 6070/httpd-prefork
boven:~ #
I changed that (well, after a lot of trial and error and consulting the Apache docs) in
Listen 0.0.0.0:80
and that gave
boven:~ # netstat -tulp | grep htt
tcp 0 0 0.0.0.0:www-http 0.0.0.0:* LISTEN 6530/httpd-prefork
boven:~ #
My conclusion.
The former configuration only listened on IPv6 addresses. The newer only on IPv4 addresses.
The other system apparently tried the IPv4 address.
I will experiment a bit more, because it is not quite clear to me what defaults are, etc. But Im up and runing again.
Now the question is how this applies to your case. Because as far as I understand it, Listen is for the whole server and not for images .
Hi all.
The “err_content_length_mismatch” error is what I was seeing when I first updated my server to 15.1.
Static text html was served as it should be. anything else failed with that error.
Tracked it down to this bug.
https://bugzilla.opensuse.org/show_bug.cgi?id=1144162
Might be an avenue of investigation?
I solved the problem inactivating ipv6 from yast -> network settings.
Thank you so much for posting the solution!
Just noticed the issue today, having upgraded a few days ago and I was completely puzzled!
- Itai