Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: @rjen on March 10, 2018, 02:33:33 PM

Title: Image proxy issue? IOS and IE do not process an image that FF and Chrome do..
Post by: @rjen on March 10, 2018, 02:33:33 PM
I encountered this issue on my forum today:
(Running SSL for a year now and using the Image proxy on 2.0.15.)

This picture is not showing for users that are on an IOS device or on IE. Users on FF or Chrome or Android can see the image.
(http://www.dewoudklank.nl/files/2014/03/fd-paaseitjes1.jpg)

At first I thought it was related to the http of the image, but this image below is showing for everyone.
(http://www.wellingweb.nl/joomla/images/afbeeldingen/2013/bagagerek_016.jpg)

There must be something related to the image proxy and how different brosers process the file.
If I check the link presented for the first image I can display this in another window without issues but the browser if showing a broken image link, even after refreshing the  screen...

https://test.fjr-club.nl/proxy.php?request=http%3A%2F%2Fwww.dewoudklank.nl%2Ffiles%2F2014%2F03%2Ffd-paaseitjes1.jpg&hash=f5f0966254e742253116c1a5349f48de

The phenomenon can be seen here:
https://test.fjr-club.nl/index.php?topic=21794.0
Title: Re: Image proxy issue? IOS and IE do not process an image that FF and Chrome do..
Post by: @rjen on March 10, 2018, 02:38:53 PM
I am using an updated version of the proxy.php file (incorporated some fixes from this forum). At first I thought that was the cause (this site is showing th pics without issue) but also the original source file from SMF has this issue, so it must be something else...
Title: Re: Image proxy issue? IOS and IE do not process an image that FF and Chrome do..
Post by: shawnb61 on March 11, 2018, 01:34:39 AM
Found it...  The content-length of the pic that fails is -1 (see attached pic)... 

The response header from the image's server doesn't provide a content-length:
server Apache
last-modified Mon, 31 Mar 2014 12:01:52 GMT
etag "70930e9f36fc435229e75f151e4ddc2c"
expires Tue, 11 May 2021 15:31:45 GMT
vary Accept-Encoding
x-id web3
content-type image/jpeg
cache-control max-age = 691200
transfer-encoding chunked
date Sun, 11 Mar 2018 06:37:15 GMT
x-varnish 999501921 999481330
age 3109
via 1.1 varnish
connection close
x-cache-server varnish1.ndc
x-lb lb1


Some servers filter out the bogus -1, & some don't.  The image proxy probably shouldn't serve up the -1.
Title: Re: Image proxy issue? IOS and IE do not process an image that FF and Chrome do..
Post by: @rjen on March 11, 2018, 03:38:44 AM
So is that fixable?

(And Why does this forum not have the issue? Or is it MY server?)
Title: Re: Image proxy issue? IOS and IE do not process an image that FF and Chrome do..
Post by: shawnb61 on March 11, 2018, 12:01:45 PM
The SMF servers & my host both detect the -1 and discard it.   My local wamp server does not, so I was able to reproduce your bug locally.  So, some hosts fix it and some don't...   

Yes, it is fixable. 

In the serve() function, only putting out the content-length when you have a valid value works, like this:
header('Content-type: ' . $cached['content_type']);
if ($cached['size'] > 0)
header('Content-length: ' . $cached['size']);
echo base64_decode($cached['body']);
}


Title: Re: Image proxy issue? IOS and IE do not process an image that FF and Chrome do..
Post by: @rjen on March 11, 2018, 01:18:00 PM
Thanks, problem solved. Thanks for looking into this shawn61!

Can this be incorporated with the next version of the image proxy or do I need to report the bug seprately in GitHub somewhere?
Title: Re: Image proxy issue? IOS and IE do not process an image that FF and Chrome do..
Post by: shawnb61 on March 11, 2018, 01:38:03 PM
The issue was reported (& solved) on Github for 2.1.   So the devs are aware, & there will likely be a 2.0.x fix.