How to use Amazon CloudFront with ShortPixel Adaptive Images

If you want to use your own account of Amazon CloudFront as your CDN when using ShortPixel Adaptive Images, instead of ShortPixel's CDN, first you need to go through the creation of a distribution: Working with distributions

Adding an Alternate Domain Name (CNAME)

On the distribution, you will have to add an Alternate Domain Name (CNAME) that points to For instance, if your domain is, you could use For more information, please visit Using Custom URLs for Files by Adding Alternate Domain Names (CNAMEs) - Amazon CloudFront

You should know that CloudFront, by default, does not send your CNAME as Host header. Instead, it sends In other words, you will see your images delivered from instead of your chosen CNAME (like To correct this, please follow these steps:

  1. Choose your distribution
  2. Choose the Behaviors tab
  3. Select the path you are using and then click on "Edit"
  4. Look for the option "Cache Based on Selected Request Headers" and select "Whitelist".
  5. Under "Whitelist Headers", add the header "Host" to the right column

  6. Click on "Yes, Edit" to save the changes.

Changing the API URL

The second step would be to change the API URL on ShortPixel's settings. Following the previous example, where the CNAME you created was,

  1. Go to your WordPress dashboard and then Settings > ShortPixel AI > Behaviour. 
  2. Enter in the API URL field.

Please notice that we are not responsible for any changes made by Amazon that would invalidate the previous steps. Therefore, if you encounter any issues while creating or editing the distribution, please contact your CDN provider.

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