Advertisement:

Author Topic: Image proxy issues in 2.0.15  (Read 2348 times)

Offline tjbalon

  • Jr. Member
  • **
  • Posts: 106
Image proxy issues in 2.0.15
« on: December 22, 2017, 10:59:31 PM »
Pretty sure this goes here...

It seems that the image proxy on my website is no longer functioning correctly. Mainly, whenever there is a website that has https on it, if the user linked the http version, the image does not properly re-direct.

For us it actually seems all websites are not working properly with the proxy.

Examples as followed:
[img]http://tangoservers.net/templates/qs/assets/images/slider/csgo.png[/img]
[img width=600 height=65]http://www.wwnorton.com/college/polisci/we-the-people9/essentials/img/bg.png[/img]

Both proxy's end up as:
https://tangoworldwide.net/proxy.php?request=http%3A%2F%2Ftangoservers.net%2Ftemplates%2Fqs%2Fassets%2Fimages%2Fslider%2Fcsgo.png&hash=0bac4421e85b12c29edeb6842594e3c6
https://tangoworldwide.net/proxy.php?request=http%3A%2F%2Fwww.wwnorton.com%2Fcollege%2Fpolisci%2Fwe-the-people9%2Fessentials%2Fimg%2Fbg.png&hash=fc70ce8be0419510e1d5b0e9d0674395

We've noticed this issue since the update to 2.0.15. Not too sure what is causing it, however it broke a lot of images on our website that may be linking to http versions of https available content. While we can surely have our staff make the adjustment, we cannot enforce it on 1000+ posts per day to ensure all users check.

Help would be appreciated, or feedback if there's any fixes that pre-exist.
Class-CurlFetchWeb: https://paste.tangoworldwide.net/view/25c91bc4
proxy: https://paste.tangoworldwide.net/view/fe4661cc

Currently talking about post-view, haven't tested avatar yet.
The images work here just fine, but we have not modified any of these files much.. I had a replacement to fix imgur on version 2.0.14: https://www.simplemachines.org/community/index.php?topic=554630.msg3931970#msg3931970 (I have removed my code edits)

File permissions are correct.
Image caching is at 1kb, aka disabled.
« Last Edit: December 22, 2017, 11:20:50 PM by tjbalon »

Online shawnb61

  • Support Specialist
  • Sr. Member
  • *
  • Posts: 939
    • sbulen on GitHub
Re: Image proxy issues in 2.0.15
« Reply #1 on: December 23, 2017, 12:45:57 PM »
I think there are two issues here.   

Issue 1:  With a 1k file size limit on caching, nothing works in my test.  I guess the question is what to do with caching turned on, but the maximum file size too low.  0k or 1k behave the same.   

The temp solution here is to either disable the cache by deselecting the "Enable Image Cache" setting (if you really want to disable it) OR to provide a more reasonable max file size.  Both approaches work. 

The longer term fix is to determine what to do when images are larger than the max file size, with image caching enabled.  I think they should be displayed as http, that doesn't appear to be what is happening now.


Issue 2:  The "refresh" issue.  First time thru, the image is cached, but not displayed.  2nd time thru the image is displayed.  This is a dupe of this issue:
https://www.simplemachines.org/community/index.php?topic=557511.0

The temp fix is to refresh the page. 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline tjbalon

  • Jr. Member
  • **
  • Posts: 106
Re: Image proxy issues in 2.0.15
« Reply #2 on: December 23, 2017, 09:22:45 PM »
Shawn, what happens when an image is over the cache then? This (1kb) was working on 2.0.14 proxying images. Now they are all blank 404 pages.


Online shawnb61

  • Support Specialist
  • Sr. Member
  • *
  • Posts: 939
    • sbulen on GitHub
Re: Image proxy issues in 2.0.15
« Reply #3 on: December 23, 2017, 11:51:45 PM »
The 1kb isn't a cache size.   It is the maximum image size to cache.   So by setting it so low, you are telling it only to cache very tiny images.   As noted above, it isn't doing anything with images above the threshold at the moment.

Were you trying to disable it by setting it to 1kb?  If so, deselect the "Enable Image Cache" setting instead.

If you want to really use the feature, you need to set that value sufficiently high.   Given the bug noted above, where http images above the max file size aren't displayed at all, I would start with a very high value, like 10000k.

« Last Edit: December 24, 2017, 12:30:17 PM by shawnb61 »
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline tjbalon

  • Jr. Member
  • **
  • Posts: 106
Re: Image proxy issues in 2.0.15
« Reply #4 on: December 26, 2017, 10:04:21 PM »
The 1kb isn't a cache size.   It is the maximum image size to cache.   So by setting it so low, you are telling it only to cache very tiny images.   As noted above, it isn't doing anything with images above the threshold at the moment.

Were you trying to disable it by setting it to 1kb?  If so, deselect the "Enable Image Cache" setting instead.

If you want to really use the feature, you need to set that value sufficiently high.   Given the bug noted above, where http images above the max file size aren't displayed at all, I would start with a very high value, like 10000k.
I was under the impression instead of caching, you could on-demand proxy the images through your image proxy. Which is why I selected 1kb.

Is this not the case? (This was working on 2.0.14)

Online shawnb61

  • Support Specialist
  • Sr. Member
  • *
  • Posts: 939
    • sbulen on GitHub
Re: Image proxy issues in 2.0.15
« Reply #5 on: December 26, 2017, 11:04:46 PM »
The way the image proxy works is by caching local copies of the http images, in order to be able to serve them up via https.  This has not changed between 2.0.14 & 2.0.15.

I don't know why such a low value appeared to work before.

If you want the image proxy to work (for images larger than 1k), you will need to increase that value. 


EDIT:  I was able to reproduce the behavior you describe in 2.0.14. 
EDIT2: ...However, the page was flagged as insecure (no padlock).  For all intents & purposes, I believe the proxy was disabled. 
« Last Edit: December 27, 2017, 12:20:38 AM by shawnb61 »
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline tjbalon

  • Jr. Member
  • **
  • Posts: 106
Re: Image proxy issues in 2.0.15
« Reply #6 on: December 27, 2017, 12:48:29 PM »
That is weird, it was working as secure for us.

I am wondering, why not have an implementation where the proxy will serve on request instead of caching? I do not mind either way, I am fine caching the images, but I wanted to proxy ALL images including https.

This way all content is considered 'safe' through our website.

Online shawnb61

  • Support Specialist
  • Sr. Member
  • *
  • Posts: 939
    • sbulen on GitHub
Re: Image proxy issues in 2.0.15
« Reply #7 on: December 27, 2017, 01:47:02 PM »
This may be feasible - I'm not sure, actually.

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

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 20,459
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Image proxy issues in 2.0.15
« Reply #8 on: December 27, 2017, 01:49:16 PM »
That is weird, it was working as secure for us.

I am wondering, why not have an implementation where the proxy will serve on request instead of caching? I do not mind either way, I am fine caching the images, but I wanted to proxy ALL images including https.

This way all content is considered 'safe' through our website.
I replied to someone in another topic about a  way to do it just requires a couple edits in the SMF code.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro