XF 2.0 Image proxy randomizing images

Lukas W.

Formerly katsulynx
After moving to my new server, I missed setting the directory permission for data and internal_data to writeable for a few hours. Some of my members posted some images meanwhile and ever since then, the image proxy seems to be completely broken. Whenever some images are requested, he seems to be randomly drawing some out of his proxy cache. Every time one reloads the page, different images are loaded. It's really weird... (Video) Are there any tools I can use or measures I can take to correct these issues?
 

Mike

XenForo developer
Staff member
To confirm, is this just happening to one user? You mention "his proxy cache" so I'm not sure. If so, that's certainly an issue with the proxy on his end.

However, if you have a reverse proxy involved, that could be the cause here, notably if it's disregarding the query string in terms of considering what to return from the cache.
 

Lukas W.

Formerly katsulynx
To confirm, is this just happening to one user? You mention "his proxy cache" so I'm not sure.
Ah no, by "him" I was referring to the XF image proxy. It's happening to my users and me as well. If I open up the image proxy log on the backend, it's the same phenomenon. I disabled the proxy for a few minutes and the images went through (as expected) without randomization, after enabling it again, it stayed like that for another 5 minutes, then it started to randomly shuffle them again.

However, if you have a reverse proxy involved, that could be the cause here, notably if it's disregarding the query string in terms of considering what to return from the cache.
How could I check that? I've installed the server software myself, so unless there is some default caching that comes with apache2 or php7.0, there should be none.

Also, if I open the images directly, the correct image is loaded.
 

Mike

XenForo developer
Staff member
While I'm not 100% positive, a lot of testing seems to point to this likely being a Chrome/Chromium bug (thus in Opera too). It's possible it may also depend on server response specifics. It doesn't appear to be something we can really workaround.

It isn't something that I could reproduce with Chrome Beta (63), so hopefully it will resolve itself in the coming weeks.
 

Lukas W.

Formerly katsulynx
@Mike My chrome just updated to Version 63.0.3239.84 (Official Build) (64-bit), so I gave this another try and turned on the image proxy once again. However, the issue is still present and images keep getting randomized.
 

Mike

XenForo developer
Staff member
I've replied to your conversation about this. I can reproduce this now in the Chrome dev channel (64) though not currently in canary (65), so it's very possible that the relevant changes are being deferred. If possible, the next step may be to produce a reduced test case that we can report to them.
 

Lukas W.

Formerly katsulynx
@Mike, as adviced, I've posted the images in question here, but the image proxy seems to work. I've tried to refresh a couple of dozen times, but they were never shuffled randomly.
 

Fethi.dz

Well-known member
I had the same problem above, many users who use chrome/android devices complained about pictures take random places when I enable the XF Proxy.

So I did some search and found this .htaccess code which solved my problem.

Code:
<IfModule mod_deflate.c>
        # Insert filter
        SetOutputFilter DEFLATE

        # Netscape 4.x has some problems...
        BrowserMatch ^Mozilla/4 gzip-only-text/html

        # Netscape 4.06-4.08 have some more problems
        BrowserMatch ^Mozilla/4\.0[678] no-gzip

        # MSIE masquerades as Netscape, but it is fine
        # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

        # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
        # the above regex won't work. You can use the following
        # workaround to get the desired effect:
        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

        # Don't compress images
        SetEnvIfNoCase Request_URI \
        \.(?:gif|jpe?g|png)$ no-gzip dont-vary

        # Make sure proxies don't deliver the wrong content
        Header append Vary User-Agent env=!dont-vary
</IfModule>
 

Hizen

Member
Hello,

Here on my site https://forum.blackout-ro.net, all users are experiencing a problem in which images are displaying as a different image. From what I've noticed, it has something to do with the image proxy's interaction with https.

The only way to fix the image and have it display correctly is to refresh your page.

Please help. This is especially bad when an image is the focal point of a post.
 

Chris D

XenForo developer
Staff member
It's not something we've had reported nor seen ourselves. Can you provide URLs where we can see the issue in place?
 

Hizen

Member
I guess you can check my forum on the more popular threads? (link in OP) It is not consistent, so if I link you to a particular post, it probably won't show for you.

Here is what one user's post looked like:
1519395575264.png

But it should look like this:
1519395614747.png
 

MetalAZ

Member
I've seen this happen as well. I saw this on a funny meme thread where each post was a different image and most weren't uploaded, they were from another site. Very randomly one or more pictures would show as the wrong one -- as a different picture that's in the thread.
 

Chris D

XenForo developer
Staff member
I knew the issue seemed familiar from somewhere.

There's a suggestion by Mike that it's related to a bug in Chrome. Are all of the users reporting this using Chrome?

If anyone can reproduce this with some regularity, it might be worth downloading Canary and testing it with that:
https://www.google.co.uk/chrome/browser/canary.html

(It functions as a separate browser, rather than affecting your main Chrome browser).

Canary will probably be at version 66 right now. Mike could reproduce it in Chrome 64 but not Chrome 65.

If the issue appears to be resolved in Canary, then certainly a reasonable workaround would be what @Fethi.dz links to above.
 

Fethi.dz

Well-known member
Hi @Chris D, all the reports where related to chrome users or even android users who uses the default browser. I also did a test on both stable and canary version and the bug still exist. So the work around was to add those codes to htaccess file which solved my problem.
 

Lukas W.

Formerly katsulynx
I've just remembered this issue and checked out whether images were still randomized. I've reactivated my image proxy and it didn't take long to notice that things haven't improved, they've seemingly worsened. Instead of simply randomizing the images of the current page in a completely random fashion, the image proxy now serves a bunch of completely random images from all over the page, it's really unfortunate and unusable at this point. I've checked back to our test thread, but as I reported back in December, there's no randomization there whatsoever. So there seems to be an important detail that some of the installations/servers are missing. This is also happening in the Chrome Canary version.
 

Lukas W.

Formerly katsulynx
As of Chrome 66 this is unfortunately still an issue that is preventing me from using the image proxy. Any recommended workaround @Mike ? I don't understand what the above posted .htaccess config does, so even if it wouldn't trigger a missconfiguration error on my server, I wouldn't want to use it.
 
Top