Can I use a different CDN with your service?

If you're interested in using a different CDN when serving optimized images from ShortPixel via ShortPixel Adaptive Images or Autoptimize, then please:

  1. Edit your DNS records and add a CNAME from cdn.example.com to no-cdn.shortpixel.ai - please note that you should replace "example.com" with your actual domain name.

    1. If you're using ShortPixel Adaptive Images, have a look at the following document: Can I use a different CDN with ShortPixel Adaptive Images?
    2. If you're using Autoptimize, in your WordPress plugin add a code snippet (see the example below). To add a code snippet you can use a plugin like this one.

add_filter("autoptimize_filter_imgopt_base_url","use_my_own_cdn");
function use_my_own_cdn($urlIn) {
return str_replace("cdn.shortpixel.ai","cdn.example.com",$urlIn);
}

Note: the filter name changed since version 2.5 of Autoptimize.

Here's an example of how the DNS configuration looks like when using Cloudflare:

  1. Enter your Cloudflare account
  2. Select the DNS tag from the top menu

  3. Add a new record following this example:

  4. "example-cdn" should be changed to whatever you wish, but make sure it is the same everywhere you set it up. Make sure the cloud is yellow so you can use the CDN features offered by Cloudflare.

Still need help? Contact Us Contact Us