Magento CDN integration

Introduction

Magento is an open-source eCommerce platform that is extremely easy to use. Nearly 16% of the top eCommerce web resources operate exactly on this CMS. Online merchants choose Magento because:

  • It is easy to install and modify according to your purposes and tastes.
  • It is an open-source technology that helps to find flexible eCommerce solutions.
  • It is able to save your money.
  • It offers nearly 50 payment gateways.

If you want to speed up your Magento online store, try to use a CDN service. Find the detailed instructions how to integrate CDN with Magento below.

Before you start

  • Before you take any steps please back up your files and database.
  • In the following, we will integrate a CDN service using the CDN domain 12345.r.cdnsun.net. Please visit the Services/How-To section to obtain your CDN domain.
  • To integate a CDN service on https:// website you can use https://12345.r.cdnsun.net or you can use a custom CDN domain with SSL enabled.
  • If your website embeds custom fonts then please first enable CORS for them.
  • Before you take any steps please make sure that your CDN domain is ready-to-use here.

Create CDN Static service

Please refer to Creating a CDN Static service for more details.

Enable CDN in Magento 2

  1. Log in to your Magento 2 Admin Panel.
  2. Using the left menu go to StoresConfiguration.
  3. Using the sub-menu go to GeneralWeb.
  4. Open the Base URLs section.
  5. To the Base URL for User Media Files input field fill in http://12345.r.cdnsun.net/pub/media/ as in the picture below.
    Magento 2 CDN
  6. Click on Save Config.
  7. Using the left side menu go to SystemCache Management.
  8. Refresh all caches which are out-of-date or simply click on the Flush Magento Cache button.
  9. That's all.

Magento 2 CDN integration video tutorial

Enable CDN in Magento

  1. Log in to your Magento Admin Panel.
  2. Using the top menu go to SystemConfiguration.
  3. Using the left menu go to GeneralWeb.
  4. Open the Unsecure section.
  5. To the Base Skin URL input field fill in http://12345.r.cdnsun.net/skin/ and to the Base Media URL input field fill in http://12345.r.cdnsun.net/media/ as in the picture below.
    Magento CDN
  6. Click on Save Config.
  7. That's all.

Magento CDN integration video tutorial

Notes

  • View HTML source code of your web pages to verify that you are using CDN, you should see source attribute of your images, CSS, JavaScript, etc. beginning with your CDN domain.
  • Don't see your CDN domain in source code of your web pages? If your website is using any cache plug-in/mechanism then you might want to clear/flush its cache.
  • Having troubles with custom fonts? Please refer to Using custom fonts with CDN - setting CORS for more details.
  • Still having troubles? Check your CDN URLs in our CDN content check or please refer to Debugging a CDN service for more hints.

Contact Us

 ______     ______    _____   
|      \\  /_   _//  |__  //  
|  --  //   -| ||-     / //   
|  --  \\   _| ||_    / //__  
|______//  /_____//  /_____|| 
`------`   `-----`   `-----`