Home » Blogs » Use CDN in Magento 2 Optimization

Use CDN In Magento 2 Optimization

A Content Delivery Network (CDN) is used to store media files. Content Delivery Networks are the preferred means to serve images for your online store. a content delivery network,CDN distributes your images over a secure network of servers around the world. so when a user accesses your site, that gets connected to the server closest to her location

1. Identification

Tools like GTMetrics.
Use-a-Content-Delivery-Network-CDN

2. How does it work

  • When customers open stores in the browser, the browser requests the media that is specified in the HTML.
  • 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.
  • 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 webserver sends them to the customer’s browser.

3. Admin configuration

Open backend of your site
Store > settings > configuration > General > web

3.1 Expand the base URLs section and do the following

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}}.
URLs-section

3.2 Expand the base URLs (Secure) section and do the following

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}}
Once you fill in these details click on Save Configuration.
URLs-secure-section

4. CDN services that do the responsive work itself

  • Load time of website improvement.
  • Cost of bandwidth reduction.
  • Content availability and redundancy of websites are increasing.
  • Improving website security.

Leave A Comment