Support

Find answers, guides, and tutorials to supercharge your content delivery.

Magento CDN Integration

Updated on January 3, 2019

Magento is a popular ecommerce solution for online businesses. Magento is powering about 1% of the websites worldwide and is developed and maintained by Magento, Inc., a company owned by Adobe.

A slow Magento website means less revenue, which is why it's important to choose the best CDN for Magento. With KeyCDN, the static content of a Magento website is offloaded to the CDN. Assets to an end client are always delivered from the closest KeyCDN location, which means less latency and higher throughput.

This article shows how to complete both a Magento and Magento 2 CDN integration.

How to complete a Magento CDN integration (pre version 2)

This section shows how to complete a Magento CDN integration with KeyCDN. The integration can be done with HTTPS in addition to HTTP.

  1. Create a Pull Zone or a Push Zone.
  2. Log in to the Magento admin panel to start with the Magento CDN integration.
  3. Go to System > Configuration.
  4. Once in "Configuration", go to "General" and click on "Web".
  5. Select the Unsecure section and enter the following information.
    • Base URL: Enter your website URL in the following format: http://www.yourwebsite.com

    • Base Link URL: You don't need to change this. It should be pre-populated with your Base URL

    • Base Skin URL: Fill in your Pull Zone URL that you get in the KeyCDN dashboard including the according folder for skin (e.g. http://example-hexid.kxcdn.com/skin/ or http://cdn.yourdomain.com/skin/)

    • Base Media URL: Also fill in your Pull Zone URL from the KeyCDN dashboard followed by the right folder (e.g. http://example-hexid.kxcdn.com/media/ or http://cdn.yourdomain.com/media/)

    • Base JavaScript URL: Enter again your KeyCDN URL followed by the JavaScript folder /js/ (e.g. http://example-hexid.kxcdn.com/js/ or http://cdn.yourdomain.com/js/)

      Warning: When using CDN, in some cases JavaScript may not run properly if CDN is not in your subdomain. If you encounter such issues, please change the Base JavaScript URL back to your origin server.

  6. Select the "Secure" section if you want to use HTTPS. We recommend to use HTTPS. Before you can use HTTPS, you need to make sure you've configured either Shared SSL or Custom SSL in the KeyCDN dashboard. Both Shared SSL and Custom SSL are free of charge.
    • Base URL: Enter your website URL in the following format: https://www.yourwebsite.com

    • Base Link URL: You don't need to change this. It should be pre-populated with your Base URL

    • Base Skin URL: Fill in your Pull Zone URL that you get in the KeyCDN dashboard including the according folder for skin (e.g. https://example-hexid.kxcdn.com/skin/ or https://cdn.yourdomain.com/skin/)

    • Base Media URL: Also fill in your Pull Zone URL from the KeyCDN dashboard followed by the right folder (e.g. https://example-hexid.kxcdn.com/media/ or https://cdn.yourdomain.com/media/)

    • Base JavaScript URL: Enter again your KeyCDN URL followed by the JavaScript folder /js/ (e.g. https://example-hexid.kxcdn.com/js/ or https://cdn.yourdomain.com/js/ )

      Warning: When using CDN, in some cases JavaScript may not run properly if CDN is not in your subdomain. If you encounter such issues, please change the Base JavaScript URL back to your origin server.

      • Use Secure URL in Frontend > Yes
      • Use Secure URL in Admin > Yes
  7. Save all the settings. The Magento CDN integration is completed.
  8. We recommend to quickly check the HTML code in order to verify if all the URLs have been rewritten properly.

How to complete a Magento 2 CDN integration

Follow the steps below to complete a Magento 2 CDN integration:

  1. Create a Pull Zone or a Push Zone.

  2. Log in to the Magento admin panel.

  3. Navigate to Stores > Configuration then navigate to Web.

  4. Depending on whether your website is delivered over HTTP or HTTPS you will expand either the Base URLs or Base URLs (Secure) option.

  5. From here, add your Zone URL or Zone Alias to the Base URL for Static View Files field followed by /static/. For example: http://example-hexid.kxcdn.com/static/ (remember to add the correct protocol if using HTTPS).

  6. Similarly, add your Zone URL or Zone Alias to the Base URL for User Media Files followed by /media/ For example: http://example-hexid.kxcdn.com/media/ (remember to add the correct protocol if using HTTPS).

    Note: If the above Base URLs are not working for you, try adding /pub/ to the URL (e.g. /pub/static/ and /pub/media/).
  7. Once this is complete save the config.

  8. Use the sidebar to navigate to System > Cache Management and Flush Magento Cache.

  9. Verify your HTML page source to ensure that you are properly delivering static content via the CDN.

That's it! Now your Magento installation is integrated with KeyCDN. Also, make sure to check out our additional 12 tips on how to speed up Magento performance.

Choosing the best CDN for Magento

Now that your Magento site is integrated with a CDN, you can begin taking advantage of the speed improvements, improved redundancy, and better security for your site. When choosing the best CDN for Magento, you should ensure that the CDN provider supports the new HTTP/2 protocol, uses optimized SSD servers, and offers SSL options such as free Let's Encrypt certificates.

KeyCDN has also developed a series of tools and maintains a knowledge base. Check these pages as well:

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started
KeyCDN uses cookies to make its website easier to use. Learn more