How to use Fastly with ShortPixel Adaptive Images

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

  1. Create an account with Fastly if you have not already done so: https://www.fastly.com/
  2. Go to Deliver > Create a Delivery service.

  3. Name the service for better organization. Go to Options > Edit service name in the top bar and give it a better name. For example, "SPAI with Fastly".

  4. 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.
  5. Assuming you have chosen "img", now enter "img.mywebsite.com" as the domain.

  6. Go to Origins, on the left, and enter "no-cdn.shortpixel.ai" as your host.

  7. Activate the Service.

  8. In your DNS editor, from your domain (ask your domain provider if you don't know where it is), add a new CNAME record from img.mywebsite.com to "n.sni.global.fastly.net".

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

  9. Wait 5 minutes for your domain provider to complete all technical tasks in the background.
  10. Check with this tool if your CNAME is propagated correctly. If not, wait 24h-48h.
  11. Take any image URL from your website, append it to http://img.mywebsite.com/spai/q_lossy+ret_wait/ (note that it does not have HTTPS, we will take care of that later) 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: http://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.
  12. Return to Fastly and go to Secure > TLS Management and click on Get started.

  13. Add your custom subdomain (in our case "img.mywebsite.com") and click on Add.

  14. Now click Submit at the bottom of the page and wait for the process to complete.

  15. You have done everything on Fastly. 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.

  16. Clear your WordPress cache: How to clear WordPress cache
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us