Jump to content

SSL in mediaservers without Wildcard problems (Tools.php)


Recommended Posts

I am setting mediaservers with ssl and I added the code "&& Tools::usingSecureMode() == false" in Tools.php according this post but dont work in PS because transform the cdn url in the main domain https://www.mysite.com/img/xxx.jpg

If I disable ssl in all pages then url work right with subdomain http://cdn1.mysite.com/img/xxx.jpg
I activated in plesk the cdn subdomains with all his dns and are redirected to https://www.mysite.com
I attach my full override of tools.php with the hope that someone may know that it may be wrong
best regards

class Tools extends ToolsCore
    public static function getMediaServer($filename)
        if (self::$_cache_nb_media_servers === null && defined('_MEDIA_SERVER_1_') && defined('_MEDIA_SERVER_2_') && defined('_MEDIA_SERVER_3_')) {
            if (_MEDIA_SERVER_1_ == '') {
                self::$_cache_nb_media_servers = 0;
            } elseif (_MEDIA_SERVER_2_ == '') {
                self::$_cache_nb_media_servers = 1;
            } elseif (_MEDIA_SERVER_3_ == '') {
                self::$_cache_nb_media_servers = 2;
            } else {
                self::$_cache_nb_media_servers = 3;

        if ($filename && self::$_cache_nb_media_servers && Tools::usingSecureMode() == false && ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1))) {
            return constant('_MEDIA_SERVER_'.$id_media_server.'_');

        return Tools::usingSecureMode() ? Tools::getShopDomainSSL() : Tools::getShopDomain();
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...