How to set up a CDN with PrestaShop

Setting up a CDN (Content Delivery Network) with PrestaShop helps significantly reduce loading times by serving static content (like images, CSS, JS) from servers closest to your users.
Step-by-Step: How to Set Up a CDN in PrestaShop
Step 1: Choose a CDN Provider
Popular options include:
- Cloudflare (Free + Paid)
- BunnyCDN (Affordable and fast)
- KeyCDN
- Amazon CloudFront (more advanced)
Step 2: Set Up Your CDN Account
After selecting a CDN provider:
- Create an account.
- Add your domain (e.g.,
yourstore.com) as a pull zone. - Note the CDN URL (e.g.,
yourstore.b-cdn.netorcdn.yourstore.com).
Step 3: Configure Static File Rules in PrestaShop
For PrestaShop 1.7, 8, or 9:
- Log in to the back office.
- Navigate to Advanced Parameters → Performance.
- Scroll to Media servers (use only with CCC).
- Add your CDN domain, such as
cdn.yourstore.com.
Note: You must enable Smart Cache for CSS and JavaScript for media server fields to work.
Step 4: Update DNS (if using a custom subdomain)
- Go to your DNS manager (e.g., Cloudflare, GoDaddy).
- Add a CNAME record:
- Name:
cdn - Target: your CDN hostname (e.g.,
yourstore.b-cdn.net)
- Name:
- Wait for DNS propagation (5–30 minutes).
Step 5: Test CDN Delivery
To confirm the CDN is serving your static files:
- Open your website and inspect it using browser developer tools.
- Go to the Network tab and verify that image, JS, and CSS files are being served from your CDN URL.
- You can also test performance with tools like:
Optional: Use a CDN Integration Module
If you prefer a module-based solution, consider:
- BunnyCDN Integration (third-party module)
- Cloudflare Official Module for PrestaShop
- Or hosting-provider CDN setup tools
Bonus Tips
- Clear PrestaShop cache after making CDN changes.
- Ensure your CDN supports HTTPS (SSL).
- Enable GZIP compression and browser caching from your CDN dashboard.
Final Result
Once configured, your PrestaShop store will serve static content faster, improve global page speed, and enhance user experience and SEO performance.
