Jump to content

CCC and CDN Files


Recommended Posts

Hello, i have two problems with activated CDN and CCC for CS and JS.

 

I created a CDN Push Area and moved my files to the CDN.

If i activate the Media Servers in BO, my Images are broken and dont work (404), the redirect to the  right path dont work anymore. For example:

 

Without CDN everything ok:
Local Path for the Image

/img/p/2/1/5/215-picture_default.jpg


and the the rewrite shows
/215-zoom_default/product_name.jpg

 

With CDN

Local Path in the Image
/img/p/2/1/5/215-picture_default.jpg


and the the rewrite shows
/215-zoom_default/product_name.jpg

 

but PS says 404 and the images not shows, because the rewrite to the local path dont work, the system looking for  cdnserver/215-zoom_default/product_name.jpg
and not cdnserver/img/p/2/1/5/215-picture_default.jpg so the local image cannot be found

 

I try to change this Script in classes/Link.php:

 

if ($this->allow == 1)
$uri_path = _PS_BASE_URI_.$id_image.($type ? '-'.$type : '').$theme.'/'.$name.'.jpg';
else
$uri_path = THEME_PROD_DIR.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').$theme.'.jpg';

 

change it to

 

if ($this->allow == 1)
$uri_path = THEME_PROD_DIR.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').$theme.'.jpg';
else
$uri_path = THEME_PROD_DIR.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').$theme.'.jpg';

 

After that the Images Show but only the local path /img/1/2/3/123.jpg and not the rewrited path.

 

The Second issue

 

if i activate CCC for Css and JS also activate the CDN Media Settings the cache files written in the domain.com/themes/theme-name/cache instead to cdn.domain.com/themes/theme-name/cache/ so i became errors the cached CSS and JS File not found on the CDN Server. How its this possible to create the cache files in the right path if i activate CDN,? correct path is the CDN cache path

 

I looking myself on classes/media.php - > public static function cccCss($css_files) but dont have luck.

 

Have someone similar issue or solution for that problem?

thanks for help

Edited by m3442a (see edit history)
Link to comment
Share on other sites

I have done a lot of testing, what makes you think a push zone is faster?

 

But to answer your questions, if you have a pull zone set up it should pass through to the server if it does not have a file cache. If that isn't working something is wrong with your setup or your cdn.

 

But to answer your question, PrestaShop will work with a push zone, but it is more difficult to set up. What you would need to do is map your pull zone into your file system for your image directory, and your theme cache directory. 

 

What CDN are you using? Are you trying to load balance with front end nodes? It is different if you are doing that. 

Link to comment
Share on other sites

  • 3 years later...
On 5/23/2015 at 3:05 AM, Dh42 said:

I have done a lot of testing, what makes you think a push zone is faster?

 

But to answer your questions, if you have a pull zone set up it should pass through to the server if it does not have a file cache. If that isn't working something is wrong with your setup or your cdn.

 

But to answer your question, PrestaShop will work with a push zone, but it is more difficult to set up. What you would need to do is map your pull zone into your file system for your image directory, and your theme cache directory. 

 

What CDN are you using? Are you trying to load balance with front end nodes? It is different if you are doing that. 

 

hello

I was reading on your website the article "Prestashop and Media Servers".

Can this setup be applied for prestashop 1.7.4.2? is it always the same?

Best regards

Link to comment
Share on other sites

8 hours ago, Dh42 said:

It generally can be, but using fake media servers is not suggested any more. If you are using a real CDN it should work fine though. 

 

Thanks for your response and the great article. 

i still would like to try this and i checked but cant find the editorial module and the blockadvertising module what needs to be copied to the img/modules folder.

any advice would be appreciated.

 

Best regards

 

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...