Advertisement:

Author Topic: Image Proxy Redirect issue, after patch.  (Read 1155 times)

Offline Dumke

  • Semi-Newbie
  • *
  • Posts: 46
Image Proxy Redirect issue, after patch.
« on: December 20, 2017, 05:51:31 AM »
Hi,

I'm still experiencing the https image redirect issue with sites that are posted as http but redirect to https on parse
such as imgur and tinypic.

I have the latest updates for SMF.

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,737
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Image Proxy Redirect issue, after patch.
« Reply #1 on: December 21, 2017, 12:35:48 PM »
I'm sorry, I'm a bit out of touch - what issue exactly is this? What is happening?
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 51,567
Re: Image Proxy Redirect issue, after patch.
« Reply #2 on: December 21, 2017, 12:45:02 PM »
maybe related to https://www.simplemachines.org/community/index.php?topic=553901.0 this is reported to have been fixed in 2.0.15 though.

Offline Dumke

  • Semi-Newbie
  • *
  • Posts: 46
Re: Image Proxy Redirect issue, after patch.
« Reply #3 on: December 22, 2017, 04:47:38 AM »
It's exactly as Illori suggests.

It sporatically works across my site.
some specific sites work and sometimes don't.
sometimes deviantart url's are correctly proxied, sometimes they 404.
same happens with tinyurl, tumblr, tinypic, various wikia pages, imgur still occasionally does it.

The images that don't work on my site, nor display, however they work here after 2-3 refreshes.
« Last Edit: December 22, 2017, 05:15:04 AM by Dumke »

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,737
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Image Proxy Redirect issue, after patch.
« Reply #4 on: December 22, 2017, 01:09:55 PM »
The images that don't work on my site, nor display, however they work here after 2-3 refreshes.
Out of curiosity, and to try diagnose this further - could you post some example photos here?
I might be tempted to try them on a couple of forums I run too, to see if I can get similar results.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,206
  • Gender: Male
    • i30 Owners Club
Re: Image Proxy Redirect issue, after patch.
« Reply #5 on: December 22, 2017, 06:33:15 PM »
@Dumke

Look at lines 192 - 197 in your file proxy.php

Does it look like this?

Code: (check) [Select]
return file_put_contents($dest, json_encode(array(
'content_type' => $headers['content-type'],
'size' => $response['size'],
'time' => time(),
'body' => base64_encode($response['body']),
))) === false ? 1 : null;;

If so, change it to look like this:

Code: (replace) [Select]
return (file_put_contents($dest, json_encode(array(
'content_type' => $headers['content-type'],
'size' => $response['size'],
'time' => time(),
'body' => base64_encode($response['body']),
)))) === false ? false : true;

References:

https://www.simplemachines.org/community/index.php?topic=553914
https://www.simplemachines.org/community/index.php?topic=557511.msg3950735#msg3950735

Offline tjbalon

  • Jr. Member
  • **
  • Posts: 106
Re: Image Proxy Redirect issue, after patch.
« Reply #6 on: December 22, 2017, 10:39:21 PM »
Having this issue as well..

Any website with existing SSL on it, if you attempt to link the non-HTTPs version but the website has a 301 redirect for the https version, it will not work.

Bug report ref: https://www.simplemachines.org/community/index.php?topic=557878.0
« Last Edit: December 22, 2017, 11:18:06 PM by tjbalon »

Offline Tw2Stefan

  • Newbie
  • *
  • Posts: 4
Re: Image Proxy Redirect issue, after patch.
« Reply #7 on: December 23, 2017, 01:12:40 AM »
@Dumke

Look at lines 192 - 197 in your file proxy.php

Does it look like this?

Code: (check) [Select]
return file_put_contents($dest, json_encode(array(
'content_type' => $headers['content-type'],
'size' => $response['size'],
'time' => time(),
'body' => base64_encode($response['body']),
))) === false ? 1 : null;;

If so, change it to look like this:

Code: (replace) [Select]
return (file_put_contents($dest, json_encode(array(
'content_type' => $headers['content-type'],
'size' => $response['size'],
'time' => time(),
'body' => base64_encode($response['body']),
)))) === false ? false : true;

References:

https://www.simplemachines.org/community/index.php?topic=553914
https://www.simplemachines.org/community/index.php?topic=557511.msg3950735#msg3950735

Wasn't this fix included in 2.0.15?
Regardless, this does not resolve the issue that tjbalon has highlighted with some images not appearing when appended with http instead of https.

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,737
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Image Proxy Redirect issue, after patch.
« Reply #8 on: December 23, 2017, 04:59:52 AM »
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,206
  • Gender: Male
    • i30 Owners Club
Re: Image Proxy Redirect issue, after patch.
« Reply #9 on: December 23, 2017, 07:29:19 AM »
Quote from: Aleksi "Lex" Kilpinen
AFAIK, that should be fixed in 2.0.15

No, the "fix" was incorrectly coded as confirmed by one of the devs in one of the links I posted.

Make the code change I displayed and then test it.

Offline Dumke

  • Semi-Newbie
  • *
  • Posts: 46
Re: Image Proxy Redirect issue, after patch.
« Reply #10 on: December 23, 2017, 11:07:23 AM »
@Dumke

Look at lines 192 - 197 in your file proxy.php

Does it look like this?

Code: (check) [Select]
return file_put_contents($dest, json_encode(array(
'content_type' => $headers['content-type'],
'size' => $response['size'],
'time' => time(),
'body' => base64_encode($response['body']),
))) === false ? 1 : null;;

If so, change it to look like this:

Code: (replace) [Select]
return (file_put_contents($dest, json_encode(array(
'content_type' => $headers['content-type'],
'size' => $response['size'],
'time' => time(),
'body' => base64_encode($response['body']),
)))) === false ? false : true;

References:

https://www.simplemachines.org/community/index.php?topic=553914
https://www.simplemachines.org/community/index.php?topic=557511.msg3950735#msg3950735
Sorry for the slow response. Holiday season.

Thank you very much for your reply,
That fixes alot of issues, however alot still doesn't entirely work.

The images that don't work on my site, nor display, however they work here after 2-3 refreshes.
Out of curiosity, and to try diagnose this further - could you post some example photos here?
I might be tempted to try them on a couple of forums I run too, to see if I can get similar results.

example, works here, but not on my site.

http://media.discordapp.net/attachments/163960689352900609/394091264251002880/image.jpg

http://vignette.wikia.nocookie.net/yakuza-mob-roleplay/images/5/5e/Tumblr_n1kkxeLnyw1raiwcso1_500.gif - displays, but still 404's interesting enough.

Having this issue as well..

Any website with existing SSL on it, if you attempt to link the non-HTTPs version but the website has a 301 redirect for the https version, it will not work.

Bug report ref: https://www.simplemachines.org/community/index.php?topic=557878.0

Yes, exactly this, but out of curiosity, i tried your two example images myself, after applying @sǝๅqɯɐɥS's fix,

"csgo.png" 404's and fails to proxy, however your "bg.png" proxies just fine.


Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,737
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Image Proxy Redirect issue, after patch.
« Reply #11 on: December 23, 2017, 11:15:19 AM »
The images that don't work on my site, nor display, however they work here after 2-3 refreshes.
Out of curiosity, and to try diagnose this further - could you post some example photos here?
I might be tempted to try them on a couple of forums I run too, to see if I can get similar results.
example, works here, but not on my site.

http://media.discordapp.net/attachments/163960689352900609/394091264251002880/image.jpg

http://vignette.wikia.nocookie.net/yakuza-mob-roleplay/images/5/5e/Tumblr_n1kkxeLnyw1raiwcso1_500.gif - displays, but still 404's interesting enough.
OK thanks, That is interesting.
Both of those worked fine on my own forums, though only after 1 refresh. Not on the first display.
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline Dumke

  • Semi-Newbie
  • *
  • Posts: 46
Re: Image Proxy Redirect issue, after patch.
« Reply #12 on: December 23, 2017, 11:21:15 AM »
OK thanks, That is interesting.
Both of those worked fine on my own forums, though only after 1 refresh. Not on the first display.

If you check the console do any of them display 404 error?
that's the same interaction i get here, doesn't work first load, works second, with 404 error displayed in console.

edit: on attempt two, they cleanly proxy.

edit2: on attempt three, (the interaction purely with this site) with a different image from the same source as the other wikia link, it will fail to load first, 404 on the second load but display, third cleanly proxies no 404.
« Last Edit: December 23, 2017, 11:51:47 AM by Dumke »

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Lead Support Specialist
  • SMF Super Hero
  • *
  • Posts: 18,737
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • There's No Place Like 127.0.0.1
Re: Image Proxy Redirect issue, after patch.
« Reply #13 on: January 08, 2018, 05:10:44 AM »
Similar case in Bug Reports: Proxying images SMF 2.0.15
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.
  Fooling around with an i7 990X @ 3,47Ghz / 12Gb / Win 10 x64 / 3840x2160


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas