Image proxy issue? IOS and IE do not process an image that FF and Chrome do..

Started by @rjen, March 10, 2018, 02:33:33 PM

Previous topic - Next topic

@rjen

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.


At first I thought it was related to the http of the image, but this image below is showing for everyone.


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
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

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...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

shawnb61

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.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

@rjen

So is that fixable?

(And Why does this forum not have the issue? Or is it MY server?)
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

shawnb61

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']);
}


Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

@rjen

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?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

shawnb61

The issue was reported (& solved) on Github for 2.1.   So the devs are aware, & there will likely be a 2.0.x fix. 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Advertisement: