{"id":9580,"date":"2018-04-25T06:00:54","date_gmt":"2018-04-25T10:00:54","guid":{"rendered":"https:\/\/blog.litespeedtech.com\/?p=9580"},"modified":"2018-04-25T06:00:54","modified_gmt":"2018-04-25T10:00:54","slug":"cloudfront-cdn-and-litespeed-cache","status":"publish","type":"post","link":"https:\/\/lswp.store\/index.php\/2018\/04\/25\/cloudfront-cdn-and-litespeed-cache\/","title":{"rendered":"WpW: Setting up Cloudfront in LSCache"},"content":{"rendered":"<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-13.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-9582\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-13.png\" alt=\"WordPress Wednesday: CloudFront CDN and LiteSpeed Cache\" width=\"640\" height=\"320\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-13.png 640w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-13-300x150.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-13-600x300.png 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Welcome to another installment of <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\">WordPress Wednesday<\/a>!<br \/>\nToday\u2019s topic is: <strong>Using Cloudfront with LiteSpeed Cache for WordPress<\/strong><\/p>\n<p><em><strong>Disclaimer<\/strong>: The information contained in this post is accurate for LSCWP v2.2.2 [<a href=\"https:\/\/wordpress.org\/plugins\/litespeed-cache\/#developers\">release log<\/a>]. If you are using a newer version of the plugin, some details may have changed. Please<a href=\"https:\/\/www.litespeedtech.com\/support\/wiki\/doku.php\/litespeed_wiki:cache:lscwp\"> refer to our wiki<\/a> for the latest!<\/em><\/p>\n<p>You can configure the LiteSpeed Cache plugin to work with almost any content delivery network. Today, we\u2019ll show you how to set up CDN support, if you are using CloudFront.<\/p>\n<h2>Set Up in CloudFront<\/h2>\n<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-14.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9584\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-14.png\" alt=\"CloudFront CDN and LiteSpeed Cache: Setting up CloudFront\" width=\"1000\" height=\"173\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-14.png 1000w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-14-300x52.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-14-768x133.png 768w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-14-600x104.png 600w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p>Set up your CloudFront CDN according to <a href=\"https:\/\/docs.aws.amazon.com\/AmazonCloudFront\/latest\/DeveloperGuide\/GettingStarted.html\">the AWS instructions<\/a>.<\/p>\n<p>Make a note of the <strong>Domain Name<\/strong> they give to you (i.e. <code>d111111abcdef8.cloudfront.net<\/code>).<\/p>\n<p>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.<\/p>\n<h2>Set Up in LSCache Plugin<\/h2>\n<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-15.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9586\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-15.png\" alt=\"CloudFront CDN and LiteSpeed Cache: Setting up CDN Support in LSCache\" width=\"1000\" height=\"531\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-15.png 1000w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-15-300x159.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-15-768x408.png 768w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-15-600x319.png 600w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p>From the WordPress Dashboard, navigate to <strong>LiteSpeed Cache &gt; Settings &gt; CDN<\/strong>, and do the following:<\/p>\n<ol>\n<li>Set <strong>Enable CDN<\/strong> to <code>ON<\/code><\/li>\n<li>Enter <strong>CDN URL<\/strong>. This is the <strong>Domain Name<\/strong> you received earlier from CloudFront.<\/li>\n<li>If CloudFront will be handling your image, CSS, or JS files, set the appropriate\u00a0<strong>Include<\/strong>\u00a0buttons to <code>ON<\/code>.<\/li>\n<li>If you set any of the above buttons to <code>OFF<\/code>, check the <strong>Include File Types<\/strong> box and make sure the relevant file extensions are <em>not<\/em> listed. For the example outlined in red above, <strong>Include JS<\/strong> is set to <code>OFF<\/code> and so we also need to remove <code>.js<\/code> from <strong>Include File Types<\/strong><\/li>\n<li>Set <strong>Original URL<\/strong> to your site\u2019s domain name (i.e. <code>\/\/example.com\/wordpress<\/code>).<\/li>\n<li>Save your changes.<\/li>\n<\/ol>\n<h2>Verify<\/h2>\n<p>In our example, <strong>Include CSS<\/strong> was set to <code>ON<\/code> and <strong>Include JS<\/strong> was set to <code>OFF<\/code>. To verify that everything is working as expected, we need to take a look at the <strong>Request URL<\/strong> in the headers and see from where both CSS and Javascript are being served.<\/p>\n<p>To do so, navigate to your site, and press F12 to bring up the developer tools in the <strong>Network<\/strong> tab. Reload the page.<\/p>\n<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-16.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9588\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-16.png\" alt=\"CloudFront CDN and LiteSpeed Cache: Verifying CSS\" width=\"1000\" height=\"283\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-16.png 1000w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-16-300x85.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-16-768x217.png 768w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-16-600x170.png 600w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p>First, check for CSS. Select the <strong>CSS<\/strong> tab, and then choose the first file listed to the left. Make note of the <strong>Request URL<\/strong> header. Is it coming from the CloudFront domain? If so, then CSS is being served correctly.<\/p>\n<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-17.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9590\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-17.png\" alt=\"CloudFront CDN and LiteSpeed Cache: Verifying JS\" width=\"1000\" height=\"283\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-17.png 1000w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-17-300x85.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-17-768x217.png 768w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-17-600x170.png 600w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p>Now, check for JS. Select the <strong>JS<\/strong> tab, and then choose the first file listed to the left. Make note of the <strong>Request URL<\/strong> header. Is it coming from your original domain? If so, then JS is being served correctly.<\/p>\n<p>&#8212;<\/p>\n<p>Have some of your own ideas for future <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\">WordPress Wednesday<\/a> topics? Leave us a comment!<\/p>\n<p>Don\u2019t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:<\/p>\n<ul>\n<li>Subscribe to the <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\/feed\/\">WordPress Wednesday RSS feed<\/a><\/li>\n<li>Download <a href=\"https:\/\/wordpress.org\/plugins\/litespeed-cache\/\">LiteSpeed Cache for WordPress plugin<\/a><\/li>\n<li>Learn more about the plugin <a href=\"https:\/\/www.litespeedtech.com\/products\/cache-plugins\/wordpress-acceleration\">on our website<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>LSCWP can be configured to work with almost any content delivery network. This is how to set up CloudFront.<\/p>\n","protected":false},"author":1,"featured_media":9582,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[28],"tags":[316,317],"class_list":["post-9580","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cache","tag-wordpress","tag-wordpress-wednesday"],"jetpack_featured_media_url":"https:\/\/lswp.store\/wp-content\/uploads\/2018\/04\/null-13.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/9580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/comments?post=9580"}],"version-history":[{"count":0,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/9580\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media\/9582"}],"wp:attachment":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media?parent=9580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/categories?post=9580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/tags?post=9580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}