Last Updated on December 28, 2022 by Steve
You can configure the LiteSpeed Cache plugin to work with almost any content delivery network. Today, we’ll show you how to set up CDN support, if you are using Cloudfront. We chose Cloudfront as our CDN provider because it is extremely easy to set up, powerful and affordable. Amazon Web Services offer pay as you go model which can be cheaper than other services with monthly subscription charging you for resources you may not be using.
Make a note of the Domain Name they give to you (i.e.
Enter that domain name directly into your browser and make sure that your site comes up. If it does, then everything is in working order, and you are ready to move on to the next step.
Set Up in LSCache Plugin
From the WordPress Dashboard, navigate to LiteSpeed Cache > Settings > CDN, and do the following:
- Set Enable CDN to
- Enter CDN URL. This is the Domain Name you received earlier from CloudFront.
- If CloudFront will be handling your image, CSS, or JS files, set the appropriate Include buttons to
- If you set any of the above buttons to
OFF, check the Include File Types box and make sure the relevant file extensions are not listed. For the example outlined in red above, Include JS is set to
OFFand so we also need to remove
.jsfrom Include File Types
- Set Original URL to your site’s domain name (i.e.
- Save your changes.
In our example, Include CSS was set to
ON and Include JS was set to
To do so, navigate to your site, and press F12 to bring up the developer tools in the Network tab. Reload the page.
First, check for CSS. Select the CSS tab, and then choose the first file listed to the left. Make note of the Request URL header. Is it coming from the CloudFront domain? If so, then CSS is being served correctly.
Now, check for JS. Select the JS tab, and then choose the first file listed to the left. Make note of the Request URL header. Is it coming from your original domain? If so, then JS is being served correctly. After verification is complete return to LSCache CDN configuration page and turn Include JS to on. That’s it! You have just set up CDN using Cloudfront with LSCache plugin.
Hope you found this article helpful.