2.0.14 Image proxy does not process 'some' images

Started by @rjen, May 15, 2017, 04:22:56 PM

Previous topic - Next topic

@rjen

After the upgrade I found that not all images are correctly showing with the image proxy!

So far I found problems with all images hosted at 'myalbum' and also links to some images in my website.

Bewlow the examples, showing that the same issue is in this forum...

After installing 2.0.14 I find multiple images are not showing anymore

Some tests below:

Links to 'mijnalbum' pages


Link is : [img ]http://www.mijnalbum.nl/Foto650-HZWWBE3J.jpg[/ img]
http://www.mijnalbum.nl/Foto650-HZWWBE3J.jpg

Links to images in the same site:


Link is : [im g width=200 height=150]http://www.fjr-club.nl/Documenten/Images/Modeljaren/2002deeppurplishblue.jpg[/im g]
http://www.fjr-club.nl/Documenten/Images/Modeljaren/2002deeppurplishblue.jpg
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

Note: below example is an image which is on my server, that has moved to ssl a while ago.
There is a htaccess redirect active to redirect all http requests to https

The image link happens to be an ' old'  one: stil linking to http. The image is not showing in the old link when served via proxy, when I change the link to https it does show (but since it is no longer 'insecure' it bypasses the image proxy...

Original link


Https link


Needless to say I could go checking all links to images that can be changed to https, but that is something I am not willing to do. In my opinion the image proxy in SMF should work regardless the .htaccess redirect...

On an additional note: I just verified this in my 2.1 test installation: this problem does not occur there: so the 2.1 coding is ' better' .
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Gluz

Looks like the proxy is not handling well the redirections, 'cause the first image is redirected from an http link to its actual location that is https, so in theory it shouldn't need to use the proxy, but because the original link is not https the system use the proxy anyways.

That part is something that I don't understand form the code, and I hope someone of the Team can explain that, does the code proxy an image that is actually https from a redirection?

Arantor

I don't think it handles the redirection at all, which is why it's a problem. If it handled redirections, it would proxy it because it's been invoked at that point.

The only other solution would be at post-save-time to check to see if it redirects to HTTPS and save it if it does.

@rjen

I would suggest to just 'proxy' these images: it may be overdoing it to check for redirects first.
What would be the issue using the proxy regardless?

I have been using a workaround proxy so far see: http://www.simplemachines.org/community/index.php?topic=527996.0, this way weserve just proxys the images regardless of the redirect to https.
On the other hand the 2.1 beta 3 code works fine for these images, so there is a working solution available apparently. I just do not know what the difference is...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl


Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

@rjen

Does not seem to be the (exact) same : in this case the images are NEVER shown, refreshing does not make a difference.

I already saw that posting, but to me I do not see a definate fix there, just a discussion on a code change that may or may not work...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Yarik1980

Quote from: Kindred on May 16, 2017, 04:24:01 AM
That "fix" is just plain wrong....
At least he works for me.
A valid code is not working.
I do not pretend to be correct, the main thing for me is that my forum worked correctly until a correct solution is found.

@rjen

Just checked your 'fix'. but it does not help with the 'redirect' issue that causes the proxy not to work...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

SleePy

Open $sourcedir/Class-CurlFetchWeb.php

Find:

$this->headers[strtolower($temp[0])] = strtolower(trim($temp[1]));


Replace:

$this->headers[strtolower($temp[0])] = trim($temp[1]);


Note, that this code may end up being the patched code in the next release.  If so, you would need to revert it prior to applying the next release.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Sir Osis of Liver

This forum does not allow me to change avatar with proxy enabled, image doesn't load.  Disabled proxy, changed it again, now it works.  Using Tor.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

@rjen

Quote from: SleePy on May 17, 2017, 09:04:23 PM
Open $sourcedir/Class-CurlFetchWeb.php

Find:

$this->headers[strtolower($temp[0])] = strtolower(trim($temp[1]));


Replace:

$this->headers[strtolower($temp[0])] = trim($temp[1]);


Note, that this code may end up being the patched code in the next release.  If so, you would need to revert it prior to applying the next release.

That resolves this issue, indeed!

The one reported by Sir Osiris here remains though: Avatars previously uploaded show without problems, but changing is results in a broken avatar amage and a messages such as:

QuoteNot Found

The requested URL /eigenavatars/avatar_25_1495085439.png was not found on this server.

This happens with and without the proxy activated, and did not happen with 2.0.13. Another issue I presume?

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

SleePy

I can''t reproduce that.

I am guessing your using a custom avatar directory judging from the file path.  When I upload files it seems to work fine.  Did you update your urls for custom avatars and can php/apache write to that folder?
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

@rjen

You guessed right . Thanks for checking I Will follow up in afbeelding days and respond back then
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

sam666

I had the same problem with insecure images not showing if the proxy was enabled. The server was showing an suexec error for the proxy.php file. The file permission was set to 666. I changed this to 755 and now the http images are shown as secure on my https enabled site.

@rjen

File permissions were ok, but there was a problem with the URL on the custom avatar directory in my test forum. Problem solved
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Advertisement: