{"id":870,"date":"2024-05-07T11:44:46","date_gmt":"2024-05-07T11:44:46","guid":{"rendered":"https:\/\/kb.shortpixel.com\/docs\/how-to-use-amazon-cloudfront-with-shortpixel-adaptive-images\/"},"modified":"2025-08-27T08:41:34","modified_gmt":"2025-08-27T08:41:34","password":"","slug":"how-to-use-amazon-cloudfront-with-shortpixel-adaptive-images","status":"publish","type":"docs","link":"https:\/\/kb.shortpixel.com\/knowledge-base\/article\/how-to-use-amazon-cloudfront-with-shortpixel-adaptive-images\/","title":{"rendered":"How to use Amazon CloudFront with ShortPixel Adaptive Images"},"content":{"rendered":"<p>\n\t If you want to use your own account of Amazon CloudFront as your CDN when&nbsp;using<br \/>\n\t<a href=\"https:\/\/wordpress.org\/plugins\/shortpixel-adaptive-images\/\" rel=\"noopener\">ShortPixel Adaptive Images<\/a>, instead of ShortPixel&#8217;s CDN, <strong>first&nbsp;you need to go through the creation of a distribution:&nbsp;<\/strong><strong><a href=\"https:\/\/docs.aws.amazon.com\/AmazonCloudFront\/latest\/DeveloperGuide\/distribution-working-with.html\" rel=\"noopener\">Working with distributions<\/a>.&nbsp;<\/strong><\/p>\n<h2>Adding an&nbsp;Alternate Domain Name (CNAME)<\/h2>\n<p>\n\t On the distribution, you will have to add an&nbsp;Alternate Domain Name (CNAME) that points to<br \/>\n\t<code>no-cdn.shortpixel.ai<\/code>. For instance, if your domain is example.com, you could use <code>images.example.com<\/code>. For more information, please visit<br \/>\n\t<a href=\"https:\/\/docs.aws.amazon.com\/AmazonCloudFront\/latest\/DeveloperGuide\/CNAMEs.html\" rel=\"noopener\">Using Custom URLs for Files by Adding Alternate Domain Names (CNAMEs) &#8211; Amazon CloudFront<\/a><\/p>\n<p>\n\t<a href=\"https:\/\/docs.aws.amazon.com\/AmazonCloudFront\/latest\/DeveloperGuide\/CNAMEs.html\" rel=\"noopener\"><\/a><\/p>\n<p>\n\t You should know that&nbsp;CloudFront, by default, does<br \/>\n\t<strong>not<\/strong>&nbsp;send your CNAME as <code>Host<\/code> header. Instead, it sends <code>no-cdn.shortpixel.ai<\/code>. In other words, you will see your images delivered from no-cdn.shortpixel.ai instead of your chosen CNAME (like images.example.com). To correct this, please follow these steps:<\/p>\n<ol>\n<li>Choose your distribution<br \/>\n\t<img decoding=\"async\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-ciEZZc34k7.jpg\"><\/li>\n<li>Choose the <strong>Behaviors <\/strong>tab<\/li>\n<li>Select the path you are using and then click on &#8220;<strong>Edit<\/strong>&#8220;<br \/>\n\t<img decoding=\"async\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-5N8yeBCBel.jpg\"><\/li>\n<li>Look for the option &#8220;Cache Based on Selected Request Headers&#8221; and select &#8220;<strong>Whitelist<\/strong>&#8220;.<\/li>\n<li>Under &#8220;Whitelist Headers&#8221;, add the header &#8220;<strong>Host<\/strong>&#8221; to the right column\n<p>\n\t\t<img decoding=\"async\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-p3eK3LH134.jpg\">\n\t<\/p>\n<\/li>\n<li>Click on &#8220;Yes, Edit&#8221; to save the changes.<\/li>\n<\/ol>\n<h2>Changing the API URL<\/h2>\n<p>\n\t The second step would be to change the API URL on ShortPixel&#8217;s settings. Following the previous example, where the CNAME you created was<br \/>\n\t<code>images.example.com<\/code>,<\/p>\n<ol>\n<li>Go to your WordPress dashboard and then Settings &gt; ShortPixel AI &gt; Behaviour.&nbsp;<\/li>\n<li>Enter <code>https:\/\/images.example.com\/spai<\/code> in the&nbsp;API URL&nbsp;field.<\/li>\n<\/ol>\n<p>\n\t 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to use your own account of Amazon CloudFront as your CDN when&nbsp;using ShortPixel Adaptive Images, instead of ShortPixel&#8217;s CDN, first&nbsp;you need to go through the creation of a distribution:&nbsp;Working with distributions.&nbsp; Adding an&nbsp;Alternate Domain Name (CNAME) On the distribution, you will have to add an&nbsp;Alternate Domain Name (CNAME) that points to no-cdn.shortpixel.ai. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[35],"glossaries":[],"doc_tag":[],"class_list":["post-870","docs","type-docs","status-publish","hentry","doc_category-shortpixel-adaptive-images"],"blocksy_meta":[],"year_month":"2026-04","word_count":296,"total_views":"1125","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"admin","author_nicename":"admin_mdli53m5","author_url":"https:\/\/kb.shortpixel.com\/author\/admin_mdli53m5\/"},"doc_category_info":[{"term_name":"ShortPixel Adaptive Images","term_url":"https:\/\/kb.shortpixel.com\/knowledge-base\/category\/shortpixel-adaptive-images\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/870","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/comments?post=870"}],"version-history":[{"count":1,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/870\/revisions"}],"predecessor-version":[{"id":2392,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/870\/revisions\/2392"}],"wp:attachment":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/media?parent=870"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_category?post=870"},{"taxonomy":"glossaries","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/glossaries?post=870"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_tag?post=870"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}