View Categories

How to use KeyCDN with ShortPixel Adaptive Images

To use KeyCDN as your CDN when using ShortPixel Adaptive Images, instead of ShortPixel's CDN, follow these steps:

  1. Create an account with KeyCDN if you have not already done so: https://www.keycdn.com
  2. Go to Zones to create a new zone.
  3. Enter the following data:
    1. Zone Name: "spaimg" for example, or whatever you feel it can represent this zone used to deliver your images through our plugin.
    2. Zone Status: active
    3. Zone Type: pull
    4. Origin URL: "https://no-cdn.shortpixel.ai"
    5. Image Processing: disabled
    6. Expand the General settings and look for the SSL option. Select "letsencrypt".

      Main options
      SSL
  4. Save the new zone.
  5. Think about a name for the subdomain you want the images to be delivered from. For example, if your domain is mywebsite.com, you could choose img.mywebsite.com. If "img" is already used by another CNAME, think of something else, like images.mywebsite.com or media.mywebsite.com.
  6. Go now to Zone Aliases and click on Add Zone Alias.
  7. Enter the alias you want, which will be what you have thought of in step #5. For example, "img.mywebsite.com". Remember that mywebsite.com should be changed to your actual domain.
  8. Choose the zone you created previously.

  9. Go back to Zones and copy the zone URL.

  10. In the DNS editor of your domain (ask your domain provider if you don't know where it is), add a new CNAME record from img.mywebsite.com to the zone URL.

    Remember that mywebsite.com should be changed to your actual domain.

  11. Wait 5 minutes for your domain provider to complete all technical tasks in the background.
  12. Check with this tool if your CNAME is propagated correctly. If not, wait 24h-48h.
  13. Take any image URL from your website, append it to https://img.mywebsite.com/spai/q_lossy+ret_wait/ and make sure that the new URL can be accessed. Example:
    1. If your website is called mywebsite.com, your new CNAME is img.mywebsite.com, and your sample image is https://www.mywebsite.com/wp-content/uploads/2022/04/image.jpg,
    2. try to access this URL: https://img.mywebsite.com/spai/q_lossy+ret_wait/https://mywebsite.com/wp-content/uploads/2022/04/image.jpg
    3. Can you view it without errors? Proceed to the next step.
  14. You have done everything on KeyCDN. Now go to your WordPress website and change the API URL of ShortPixel AI.
    1. Go to Settings > ShortPixel AI > Behaviour and enter https://img.mywebsite.com/spai in the API URL field.
    2. Replace mywebsite.com with your actual domain name.
    3. Replace the img part if your subdomain is different, like configured above.

  15. Clear your WordPress cache: How to clear WordPress cache