Tag: content delivery networks

  • WpW: Using Jetpack’s Photon CDN With LSCache

    WpW: Using Jetpack’s Photon CDN With LSCache

     

     

    WordPress Wednesday: Jetpack’s Photon CDN and LiteSpeed Cache

    Welcome to another installment of WordPress Wednesday!
    Today’s topic is: Jetpack Photon CDN and LiteSpeed Cache

    Disclaimer: The information contained in this post is accurate for LSCWP v2.1.1.1 [release log]. If you are using a newer version of the plugin, some details may have changed. Please refer to our wiki for the latest!

    What is Photon?

    Automattic’s Jetpack plugin allows self-hosted WordPress blogs to use some of the functionality that is natively available to WordPress.com blogs. One of the available functions is a content delivery network (CDN) for images. Originally, this service went by the name “Photon,” but now it they simply call it “Jetpack Image CDN.” (Many people still refer to it as Photon, which is why I mention it.)

    Use of the image CDN is contingent upon your site being Jetpack-connected. If you disconnect Jetpack from your site, you are no longer allowed to use the image CDN.

    Using Jetpack Image CDN with LSCWP

    Jetpack’s Image CDN and LiteSpeed Cache for WordPress are 100% compatible and may be used together right out of the box.

    Normally we recommend enabling CDN support in the LiteSpeed plugin, and then uninstalling any CDN-specific plugin you may have had. That is not the case here.

    Because of Jetpack’s rule that Jetpack must remain connected to your site, you are not allowed to uninstall their plugin if you want to continue to use their image CDN.

     

    Jetpack’s Photon CDN and LiteSpeed Cache: Three Airplanes in Formation at an Air Show

    So, how do you make all of this work when you have both Jetpack and LiteSpeed plugins installed? It’s simple. You let Jetpack do its thing, and set up LiteSpeed to stay out of the way:

    1. Turn on the image CDN feature in Jetpack.
    2. Leave Enable CDN set to OFF in LiteSpeed Cache > Settings > CDN.

    LSCache for WordPress respects the settings of other CDN plugins, when LiteSpeed’s CDN support is turned off.

    A Note about Image Optimization

    LiteSpeed Cache has an Image Optimization service, but we don’t recommend you use it, if you have Jetpack’s Image CDN enabled. Jetpack’s CDN automatically does its own optimization, and will ignore the LiteSpeed-optimized images.

    Additionally, Jetpack has its own WebP replacement functionality, so do not enable LiteSpeed’s Image WebP Replacement setting in the Media tab.

    To Summarize

    If you want to use Photon, then LiteSpeed will respect that, as long as you leave LiteSpeed’s CDN and Image Optimization features turned off.

    One exception: if you have multiple CDNs in use (i.e., Jetpack for the images and, say, MaxCDN for other static content), you may enable LiteSpeed’s CDN support, but be sure to configure it only for the file types not served by Jetpack.

    Have some of your own ideas for future WordPress Wednesday topics? Leave us a comment!

    Don’t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:

  • WpW: LSCache New Feature Roundup!

    WpW: LSCache New Feature Roundup!

    WordPress Wednesday LSCache New Features

    Welcome to another installment of WordPress Wednesday!

    Disclaimer: The information contained in this post is accurate for LSCWP v1.6.6 [release log]. If you are using a newer version of the plugin, some details may have changed. Please refer to our wiki for the latest!

    Throughout the last several months, you may have gotten whiplash watching us release new feature after new feature in our LSCache plugin for WordPress! It’s been a whirlwind, we know. We’re at a point now where most of the big stuff been implemented, so I thought it might be a good time to give you a quick guided tour.

    First, I’ll share links to the blog posts we’ve written about the major new features, so you can read up on them in depth, and then I’ll show you some of the smaller things that didn’t get their own posts but are worth a mention just the same.

    Big Feature Roundup

    Check out the linked blog posts to learn all about the following new cache functionality and optimization features:

    Other Features You Might Like

    There are a handful of other new features that didn’t get their own blog posts. We’ve got an interface enhancement, a private cache feature, a new type of URL to exclude, and a collection of new optimization options.

    Tab Switch Shortcut

    WordPress Wednesday LSCache New Feature Tab Switch Shortcut

    We’ve got a lot of tabs in our settings at this point, so you might appreciate the ability to easily switch between tabs, if you’re more of a keyboard-user than a mouse-user.

    As long as your cursor is not focused on an input element, you can type a number, and be brought directly to the corresponding tab. For example, if you’re looking at the General tab, but want to change something in the ESI tab, simply press 9 and you will be brought to the ESI tab.

    Private Cached URIs

    From the WordPress dashboard, navigate to LiteSpeed Cache > Settings > Cache and scroll to the bottom of the page.

    WordPress Wednesday LSCache New Feature Private Cached URIs

    You may have pages on your site that would default to public cache under normal circumstances, but which you think should be cached privately (i.e. a separate copy cached for each individual user).

    Use this box to list such URI’s, one per line. You can list an entire path and place a $ after it so that it is interpreted as an exact URI. Otherwise, any URI that includes the path you enter will be privately cached.

    For example:

    reviews/canon/$ will only match reviews/canon/.

    reviews/canon/ will match reviews/canon/ and reviews/canon/eos80d/.

    Additional Excludes

    From the WordPress dashboard, navigate to LiteSpeed Cache > Settings > Excludes.

    WordPress Wednesday LSCache New Feature Additional Excludes

    Query Strings

    You can eliminate URLs with certain query strings from being cached.

    For example, let’s say you have a mechanism that allows you to colorize your site in a purple color scheme like so: http://example.com/page?color=purple.

    if you don’t want to cache any page that is rendered in a colorized way, you could enter color in that list. That would match http://example.com/page?color=purple as well as http://example.com/page?color=red, or any other specified color, and those pages would be excluded from caching.

    From the WordPress dashboard, navigate to LiteSpeed Cache > Settings > Excludes and scroll to the bottom of the page.

    Roles

    There may be user roles that you wish to exclude from caching. For example, if you are an admin testing new functionality, you may want to exclude your administrator role from being served from cache until your testing is through.

    Load JQuery Remotely

    From the WordPress dashboard, navigate to LiteSpeed Cache > Settings > CDN and scroll to the bottom of the page.

    WordPress Wednesday LSCache New Feature Load JQuery Remotely

    It can be faster to load JQuery from a remote CDN service. You may choose one here.

    Optimization and Tuning

    When we first released the Optimize tab, we wrote up a full blog post on all of the options. After that we added some new settings to the page. And then we added some more. And then, because that page was getting a bit unruly, we split Optimize into Optimize and Tuning.

    So, if the last time you saw Optimize was while reading that blog post, you’ll need to know that two of those settings we discussed (CSS Excludes and JS Excludes) now live on the Tuning page. The other functions remain on Optimize, along with several new ones.

    We recommend checking out both of those pages in our wiki’s Settings section, where every plugin setting is described in detail.

    Image Optimization

    Our image optimization feature is our newest one, and we’re still making adjustments here and there, based on what’s working well, what could use improvement, and the feedback we’ve received. Take a look at the Image Optimization page on our wiki to see how the most up-to-date features work.

    WordPress Wednesday LSCache New Features

    Thus ends our tour of the new features. Keep an eye on WordPress Wednesday in the future for more detailed exploration of various aspects of our plugin!

    For the most up-to-date configuration reference, you’ll want to keep the URL for our wiki handy. We make an effort to publish updates to the wiki as soon as anything changes in the plugin. While it might take us a few weeks to write an in-depth blog post, the wiki gets updated immediately.

    Have some of your own ideas for future WordPress Wednesday topics? Leave us a comment!

    Don’t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:

  • WpW: How to Set Up a CDN with LSCache

    WpW: How to Set Up a CDN with LSCache

    Welcome to another installment of WordPress Wednesday!

    Disclaimer: The information contained in this post is accurate for LSCWP v5.0. If you are using a newer version of the plugin, some details may have changed. Please refer to our documentation for the latest!

    LiteSpeed Cache for WordPress has the ability to support your Content Delivery Network usage. This quick guide should explain how the different settings between your CDN and LiteSpeed relate to each other.

    Cloudflare

    Make sure you have set up your Cloudflare account on the Cloudflare website. Once that’s done, switch over to your WordPress Dashboard and navigate to LiteSpeed Cache > CDN > CDN Settings.

    To manage Cloudflare through the LSCache plugin, set the following:

    • QUIC Cloud CDN: OFF
    • Use CDN Mapping: OFF, and leave all settings under it alone
    • Cloudflare API: ON, and fill in your Email Address, Global API Key, and Domain

    NOTE: You can also use Cloudflare without managing it through LSCache. If that is what you choose, just set Cloudflare API to OFF, and leave all settings under it alone. Cloudflare will work either way. The advantage of setting this up in LSCache is that you may purge your Cloudflare cache or enable Cloudflare’s Development Mode from within LSCache. If that doesn’t matter to you, feel free to skip this setup.

    QUIC Cloud

    The QUIC.cloud onboarding process is documented in the QUIC.cloud Knowledge Base, and explains how to set up everything from the LSCache plugin to your QUIC.cloud Dashboard.

    Other Reverse-Proxy CDNs

    CNAME setup in the CDN

    For this guide, we’re going to assume you have already set up your CDN account, and added your site (let’s call it example.com) according to the CDN’s instructions.

    Make sure that your CDN is configured to cache static files only. Dynamic content will be handled by LiteSpeed.

    Your CDN configuration screen should have an area for adding a CNAME record. Look for it under DNS Editor or something along those lines.

    The goal here is to set up a custom domain to be used only by the CDN. For example, cdn.example.com. Follow the CDN’s instructions for adding the CNAME record.

    Once that is complete, and the domain is active, we’ll be ready to tell WordPress how to proceed.

    LiteSpeed Cache CDN Settings

    Now that your CDN is set up and your static content is ready to be served by the CDN, you will need to let WordPress know about it. You can do this through LiteSpeed Cache.

    In your WordPress Dashboard, navigate to LiteSpeed Cache > CDN > CDN Settings.

    Make sure both QUIC Cloud CDN and Cloudflare API are set to OFF.

    • Use CDN Mapping: ON.
    • CDN URL: http://cdn.example.com.
    • Original URLs: //example.com.

    The remaining settings can be left as-is, unless you have a specific reason to change them. If you do want to adjust them, this documentation should help.

    And that’s it! Once you save your changes, LiteSpeed Cache for WordPress will substitute the CDN URL for the Original URL in the static copies it saves of your dynamically-generated code, wherever appropriate.

    Want to learn more about how all of this works? We’ve written about our CDN support in some depth before. You can check that out here.

    Have some of your own ideas for future WordPress Wednesday topics? Leave us a comment!

    Don’t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:


    This content was last verified and updated in July of 2022. If you find an inaccuracy, please let us know! In the meantime, see our documentation site for the most up-to-date information.

  • WpW: Content Delivery Network Support

    WpW: Content Delivery Network Support

    Welcome to another installment of WordPress Wednesday!

    If you use a content delivery network (or CDN) along with LiteSpeed Cache for WordPress, this week’s topic should appeal to you. You’ve always been able to use LSCWP and a CDN together, but you needed an additional plugin to do so. Now, as of LSCWP v.1.2.3, we’re officially supporting the use of CDNs, no additional plugin required!

    Please note: This article does not apply to Cloudflare. Cloudflare is not a typical CDN, in that it is a distributed proxy server, as opposed to a reverse-proxy. This article applies to reverse-proxy CDNs only.

    What is a CDN?

    Content delivery networks store static website content remotely in servers all around the world. The content may then be served to a site’s visitor from the server that is physically closest to that visitor’s location. The closer the server, the less time the data takes in transit. A CDN is a great complement to the page-caching functionality of LSCWP. LiteSpeed speeds up the serving of all of the dynamically-generated content, while the CDN speeds up the delivery of the static content (images, CSS, JavaScript, etc).

    How does LSCWP support CDN use?

    When you start using a CDN for static content, those files stop being served from your site’s file system, and instead are pulled directly from the CDN. WordPress requires a plugin to change all of the appropriate links to be CDN links. Without a plugin, you would have to manually change all of your static file links to point to the CDN’s URL. Not only is that a nuisance, but it’s not always possible to do.

    For all practical purposes, a plugin is required if you are going to use a CDN with WordPress.

    If you’re already using a CDN alongside LSCWP, you’ll know that they complement each other well. It’s a nice bonus, then, that you can now configure both in a single plugin!

    If you’re new to CDNs, you’ll appreciate the ability to get yours up and running in a familiar plugin environment.

    Setting it up

    These settings link LSCWP to your existing CDN. If you don’t currently use a CDN service, you’ll have to obtain one before these settings will be of any use to you.

    LSCWP’s CDN support works by substituting the CDN URL for your site’s URL on the relevant static files. The settings below allow you to define the parameters for these substitutions. First specify the two URLs, and then choose the static files to be included or excluded.

    Enable CDN

    This is the button that enables the functionality. If this is not turned ON then none of the other options matter. CDN support is turned OFF by default.

    Original URL and CDN URL

    Original URL defaults to your site’s root URI. It shouldn’t be necessary to change this. If you do change it, be sure that the URI begins with // as in //yoursite.com.

    CDN URL is the root URL for content that is served from the CDN. It should be a full URL beginning with http.

    When LSCWP generates the cached static version of a dynamic page, these two settings work together to allow the CDN URL to be substituted for the Original URL where appropriate.

    Includes

    These settings allow you to specify which types of static content are being handled by your CDN. They are all turned off by default, but you may turn on whichever file types are appropriate for your application. The Include Images setting refers to images that are accessed via img tags and CSS url() attributes. Images accessed in any other manner can be included through the Include File Types setting.

    Include File Types

    This setting is for files that are accessed via src, data-src, and href tags.

    Exclude Path

    If there are sections of your site that are not served from the CDN, specify the paths here (one per line) so that LiteSpeed will not go to the CDN for those. You may enter partial paths here, no wildcards required.

    If you’ve been running a site for any length of time, you know that WordPress offers many opportunities for optimization. (This is just a more positive way of saying “WordPress can be really slow.”) Page caching, browser caching, database optimization, minification, combination, HTTP/2 Push, and Content Delivery Networks are all excellent ways to speed up your site, and they are all supported in the LiteSpeed Cache for WordPress plugin!

    We hope you’ll try some of these new features soon, if you haven’t already, and let us know what you think. We love getting your feedback!

    Have some of your own ideas for future WordPress Wednesday topics? Leave us a comment!

    Don’t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do: