Wondering how to enable CDN in Prestashop? We can help you.
PrestaShop is an open-source eCommerce platform that allows us to run our online store either via self-hosting or in the cloud.
At times we may find Prestashop slowing down, we can use CDN to speed it up
Here at Bobcares, we handle requests from our customers to enable CDN in Prestashop as a part of Server Management Services.
Today let’s see how our Support Engineers do this for our customers.
How to Enable CDN in PrestaShop
Now we will see the steps that our Support Engineers follow to enable CDN
Integrate CDN with PrestaShop
Firstly, we must take a backup of files and database. If we wish to integrate a CDN service on https:// pages also, then we must use the CDN domain with SSL enabled.
If our website embeds custom fonts, then we must enable CORS first. Also, ensure that the CDN domain is ready to use.
Steps for Enabling CDN in PrestaShop
1. First, log in to the PrestaShop admin panel.
2. Then go to Advanced Parameters and take Performance.
3. Now, we must configure CCC (Combine, Compress, and Cache).
Smart Cache for CSS: Yes
4. After that click Save.
5. Finally, we must configure Media servers (use only with CCC) and click Save.
Setting a media server URL in PrestaShop will improve static content delivery, website performance, GTMetrix as images, CSS, and JS files will be serviced via a cookie-free domain.
If we do not see our CDN domain in the source code of our web pages, then the website may be using any cache plugin/mechanism.
We can clear the cache and check again. Next, we will see the common error that we may face while enabling CDN.
Common error faced
While configuring the PrestaShop Media Server URL, many customers face an issue when having this setup while using SSL certificate for their stores.
Cause for the error
The reason for the issue is that usually the SSL is valid for their main domain www/.domain.com and does not cover the Media Server subdomain used for cookie-free URL.
How to fix it
Following are the steps to fix the above error:
1. Purchase a wildcard SSL to cover the subdomains as well *.domain.com.
2. Activate Cloudflare CDN using their Universel SSL to convert subdomain.
3. Processing Static Content via Shared SSL and mod_userdir
Most hosting providers support the Apache mod_userdir which allows to access the account via the server hostname using a URL such as http://hostname/~username.
Additionally, most hosting providers have valid and trusted SSL certificate installed for the server hostname, usually advertised as Shared SSL.
This Shared SSL can process static content via a cookie-free domain and still keep it secure via the https.
Unfortunately, PrestaShop does not accept URLs including ‘~’ character for the media server settings. However, we can set this with just a quick trick.
The steps to follow are given below:
1. Before changing any settings on PrestaShop installation, ensure that the account is accessible via mod_userdir and a valid SSL is available on the hosting server.
2. Log in to the PrestaShop admin panel and navigate to the Performance section under the Advanced Parameters menu.
3. From there take Media Servers and input any dummy URL such as static.domain.com
[Need assistance? We can help you]
In short, we saw how our Support Techs enable CDN on PrestaShop for our customers.