After July 2021, the 2.3.x release line no longer received quality updates or user guide updates. PHP 7.3 reached end of support in December 2021, and Adobe Commerce 2.3.x reached end of support in September 2022. We strongly recommend upgrading to Adobe Commerce 2.4.x to help maintain PCI compliance.

Using a Content Delivery Network

This site contains archived merchant documentation for a version of Adobe Commerce and Magento Open Source that has reached end-of-support. The documentation available here is intended for historical reference only and is not maintained. The Adobe Commerce Merchant Documentation for current releases is published on the Adobe Experience League.

A Content Delivery Network (CDN) can be used to store media files. Although the version of Magento that is installed on premise does not include an integration with any specific CDN, you can use the CDN of your choice. Magento Commerce (Cloud) is an exception to this, and includes the Fastly CDN. See Fastly in the developer documentation.

After configuring the CDN, you must complete the configuration from the Admin. The changes can be made at either the global or website level. When a CDN is used for media storage, all paths to media on store pages are changed to the CDN paths that are specified in the configuration.

CDN workflow

  1. Browser requests media - A page from the store opens in the customer’s browser, and the browser requests the media that is specified in the HTML.
  2. Request sent to CDN; images found and served - The request is sent first to the CDN. If the CDN has the images in storage, it serves the media files to the customer’s browser.
  3. Media not found, request sent to Magento web server - If the CDN does not have the media files, the request is sent to the Magento web server. If the media files are found in the file system, the web server sends them to the customer’s browser.

Important! For security, when a CDN is used as media storage, JavaScript may not function properly if the CDN is located outside of your subdomain.

Configure a content delivery network

  1. On the Admin sidebar, go to Stores > Settings > Configuration.

  2. In the left panel under General, choose Web.

  3. In the upper-left corner, set Store View as needed.

  4. Expand Expansion selector the Base URLs section and do the following:

    General configuration - web base URLs Base URLs

    • Update the Base URL for Static View Files with the URL of the location on the CDN where static view files are stored.

    • Update the Base URL for User Media Files with the URL of the JavaScript files on the CDN.

      Both these fields can be left blank, or can start with the placeholder: {{unsecure_base_url}}

  5. Expand Expansion selector the Base URLs (Secure) section and do the following:

    General configuration - web base URLs (secure) Base URLs (Secure)

    • Update the Secure Base URL for Static View Files with the URL of the location on the CDN where static view files are stored.

    • Update the Secure Base URL for User Media Files with the URL of the JavaScript files on the CDN.

      Both these fields can be left blank, or can start with the placeholder: {{unsecure_base_url}}

  6. When complete, click Save Config.