Image Proxy Redirect issue, after patch.

Started by Dumke, December 20, 2017, 05:51:31 AM

Previous topic - Next topic

Dumke

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.

Aleksi "Lex" Kilpinen

I'm sorry, I'm a bit out of touch - what issue exactly is this? What is happening?
Slava
Ukraini!
"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

How you can help SMF

Illori


Dumke

#3
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.

Aleksi "Lex" Kilpinen

Quote from: Dumke on December 22, 2017, 04:47:38 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.
Slava
Ukraini!
"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

How you can help SMF

Shambles

@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

tjbalon

#6
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

Tw2Stefan

Quote from: sǝๅqɯɐɥS 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

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.

Aleksi "Lex" Kilpinen

Slava
Ukraini!
"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

How you can help SMF

Shambles

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.

Dumke

Quote from: sǝๅqɯɐɥS 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
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.

Quote from: Aleksi "Lex" Kilpinen on December 22, 2017, 01:09:55 PM
Quote from: Dumke on December 22, 2017, 04:47:38 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.

Quote from: tjbalon 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

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.


Aleksi "Lex" Kilpinen

Quote from: Dumke on December 23, 2017, 11:07:23 AM
Quote from: Aleksi "Lex" Kilpinen on December 22, 2017, 01:09:55 PM
Quote from: Dumke on December 22, 2017, 04:47:38 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.
Slava
Ukraini!
"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

How you can help SMF

Dumke

#12
Quote from: Aleksi "Lex" Kilpinen on December 23, 2017, 11:15:19 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.

Aleksi "Lex" Kilpinen

Slava
Ukraini!
"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

How you can help SMF

Advertisement: