Mr S Posted October 29, 2013 Share Posted October 29, 2013 What if i update the getMediaServer() function with && Tools::usingSecureMode() == false would this work? public static function getMediaServer($filename) { if (self::$_cache_nb_media_servers === null && Tools::usingSecureMode() == false) { 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 (self::$_cache_nb_media_servers && ($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 More sharing options...
Mr S Posted December 21, 2013 Author Share Posted December 21, 2013 FYI: I manged to get it to work for me. 1)edit override the function getMediaServer in file /override/classes/Tools.php all I did was add "&& Tools::usingSecureMode() == false" to the if statement public static function getMediaServer($filename) { if (self::$_cache_nb_media_servers === null) { 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 (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(); } 2) Backoffice > Advanced Parameters > Performance > Media servers I have mydomain.net, mydomin.co, mydomain.biz in the Media servers setting Now my media Servers only load on non SSL pages, because I don't have SSL for the other domains. Link to comment Share on other sites More sharing options...
presta'luv Posted December 21, 2013 Share Posted December 21, 2013 Hello,I followed this message because I have the same problem with CDN. I used 3 subdomains as CDN : cdn1.domaine.com, cdn2.domaine.com and cdn3.domaine.com.When the page tries to load https or httpshttpsI end up with an error because css files can't load. It's not really an error but my ssl page appears without css style !Do you think it works with subdomains as CDN? Thank you ! Link to comment Share on other sites More sharing options...
Mr S Posted December 22, 2013 Author Share Posted December 22, 2013 It should work the same as long as your CDN sub-domains (or multi-domain setup) is already loading on non SSL pages. The code above only disables media-server urls from being used by prestashop on all page request's made over https (ssl) Link to comment Share on other sites More sharing options...
Mr S Posted December 24, 2013 Author Share Posted December 24, 2013 (edited) Disregard this post the error was unrelatedIf your backoffice Products is not loading you may have to edit your admin template file because PS Backoffice is trying to load the image from one of your Media Server over https (SSL).Edit file: /admin/themes/default/template/controllers/products/informations.tpl FIND: <img src="{$image.src}" alt="{$image.legend}" /> REPLACE WITH: <a href="{$image.src|replace:'https':'http'}" target="_blank">{$image.legend}</a> Edited December 24, 2013 by HA!*!*Y (see edit history) Link to comment Share on other sites More sharing options...
presta'luv Posted January 10, 2014 Share Posted January 10, 2014 (edited) Thank you for response ! I'm trying to use your solution but i don't have a file "Tools.php" in /override/classes/ ! How can i do ? Edit the file in www/classes/Tools.php ? EDIT 1 : I edited the file ine www/classes/Tools.php but i have one problem. On the pages contact-form.php and index.php. When i'm loading this page on SSL, files in theme/mytheme/img can load because the filepath is https://cdn1.domaine.com/theme/mytheme/img/... Same thing on index.php, images can not be loaded. Edited January 10, 2014 by presta'luv (see edit history) Link to comment Share on other sites More sharing options...
Gr Graphic Designer Posted August 20, 2017 Share Posted August 20, 2017 Very good. Working for version 1.7.2 Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now