Advertisement:

Author Topic: Proxy Handler for Images..  (Read 375 times)

Offline tjbalon

  • Jr. Member
  • **
  • Posts: 101
Proxy Handler for Images..
« on: December 13, 2017, 09:12:13 PM »
So I'm not too sure where to put this, this is a bit of a support request I suppose.

Why is it that the image proxy only proxies images which are non-ssl? To what I've seen on most websites, every image will go through the proxy, non-cached, take github camo for example.

Is there an easy way to extend the proxy to proxy EVERY image instead of just those that are non-SSL.

Thanks,
TJ

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,754
    • Arantor on GitHub
Re: Proxy Handler for Images..
« Reply #1 on: December 14, 2017, 03:10:26 AM »
Because there's no point in using your bandwidth for images that will show up.

GitHub etc have a fairly large stack of servers just for handling images so it goes faster. Unless you plan on building your own CDN, changing the proxy as you suggest will make your entire site slower.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

Offline tjbalon

  • Jr. Member
  • **
  • Posts: 101
Re: Proxy Handler for Images..
« Reply #2 on: December 15, 2017, 07:52:28 PM »
Because there's no point in using your bandwidth for images that will show up.

GitHub etc have a fairly large stack of servers just for handling images so it goes faster. Unless you plan on building your own CDN, changing the proxy as you suggest will make your entire site slower.

Yeah I understand that for the most part, however we don't cache the images we simply just proxy them in-view. Is there an easy change to make it go for all images as of right now, or is that functionality difficult to achieve? I have not really gone through the proxy code, wouldn't imagine a temp change would be difficult. Considered writing a mod for it in the future, but I don't think it'd pass with that closing statement of the site being slower.

Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 20,208
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Proxy Handler for Images..
« Reply #3 on: December 15, 2017, 10:40:24 PM »
There are five spots that you need to change to ache all just have to remove http/s checks in the code such as
Require code changes such as          
Code: [Select]
if (!empty($modSettings['force_ssl']) && $image_proxy_enabled && stripos($user_settings['avatar'], 'http://') !== false)
$user_settings['avatar'] = strtr($boardurl, array('http://' => 'https://')) . '/proxy.php?request=' . urlencode($user_settings['avatar']) . '&hash=' . md5($user_settings['avatar'] . $image_proxy_secret);

Code: [Select]
if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
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

Offline tjbalon

  • Jr. Member
  • **
  • Posts: 101
Re: Proxy Handler for Images..
« Reply #4 on: December 16, 2017, 12:13:43 AM »
There are five spots that you need to change to ache all just have to remove http/s checks in the code such as
Require code changes such as          
Code: [Select]
if (!empty($modSettings['force_ssl']) && $image_proxy_enabled && stripos($user_settings['avatar'], 'http://') !== false)
$user_settings['avatar'] = strtr($boardurl, array('http://' => 'https://')) . '/proxy.php?request=' . urlencode($user_settings['avatar']) . '&hash=' . md5($user_settings['avatar'] . $image_proxy_secret);

Code: [Select]
if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);

Thanks vbgamer, you rock dude :^)

Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 20,208
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Proxy Handler for Images..
« Reply #5 on: December 16, 2017, 12:35:50 AM »
Glad to help
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