XF 1.5 Image Proxy actioning against own CDN

Mouth

Well-known member
I see in the image proxy, that it's actioning against my own site's CDN. For example, mysite.com with a CDN, as defined within library/config.php via $config['externalDataUrl'], of cdn.mysite.com

Images loaded from cdn.mysite.com are being actioned/stored by the image proxy. Since cdn.mysite.com is automatically sourced from mysite.com, it seems little point in the image proxy operating against it's own CDN.

Is there a method to whitelist/bypass the library/config.php $config['externalDataUrl'] value?
 

Mike

XenForo developer
Staff member
Changing this would require code modifications. The image proxy will apply to any external image, which is defined as coming from a different domain that what the current page is from.
 

KrisV

Member
I've just run into the identical issue after switching my website over to HTTPS. I think it's pretty common nowadays to serve images off a subdomain -- CDN or otherwise. As a quick workaround I've modified the Xenforo source code. A whitelist or a checkbox not to proxy subdomains (assuming the scheme matches!) would be very convenient.
 

KrisV

Member
In \library\XenForo\BbCode\Formatter\Base.php::_handleImageProxyOption($url) insert the following after the list() command:

Code:
$cdn = "https://cdn.domain.com";
if (substr($url, 0, strlen($cdn)) === $cdn) {
    return $url;
}
 
Top