Can I use a different CDN with ShortPixel Adaptive Images?

Important note: ShortPixel Adaptive Images works correctly out-of-the-box, so configuring it to work with your own CDN should only be done if you have good technical knowledge.

If you want to use a different CDN than the default cdn.shortpixel.ai when using ShortPixel Adaptive Images, then please:

  1. Edit your DNS records and add a CNAME from "cdn.example.com" to "no-cdn.shortpixel.ai".
    1. On the previous URL, replace "example.com" with your actual domain name.
    2. If "cdn.example.com" is already being used on your DNS records, you can change it for whatever you want, like "images.example.com" or "img.example.com".
  2. Go to Settings > ShortPixel AI > Advanced > API URL and enter the following URL: https://cdn.example.com/spai
    1. Remember to replace "example.com" with your actual domain name.
    2. Remember to replace the "cdn" part if your CNAME is different.
    3. Please note that if you're not using Cloudflare as CDN, then your CDN should be able to handle the SSL certificate so you can have the API URL with "https". If they cannot handle this, a certificate error will occur and your API URL should be "http" instead of "https".

  3. You may require to do some extra configuration on your CDN's side. We recommend you to consult with your CDN provider if this is the case.

Important: after setting up your own CDN make sure the new record works as expected with an online tool like this one: https://www.whatsmydns.net/

Example - Cloudflare

Here is a step-by-step example on how to set up the CNAME (previous step 1) on Cloudflare. Please notice that we are not responsible for any changes made by Cloudflare that would invalidate the following steps. Therefore, if you encounter any issues while creating your new CNAME in your DNS records, please contact your CDN or hosting provider.

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

  3. Add a new record following this example. 

    Remember that "your-domain.com" should be changed to your actual domain and that "cdn" should be changed to something else if it's already being used. Make sure the cloud is orange so you can use the CDN features offered by Cloudflare.

Example - StackPath

Please follow this article to know how to configure SPAI to work with your CDN in StackPath: Setup your StackPath account so that it can work with ShortPixel Adaptive Images API

Still need help? Contact Us Contact Us