{"id":959,"date":"2024-05-07T11:46:20","date_gmt":"2024-05-07T11:46:20","guid":{"rendered":"https:\/\/kb.shortpixel.com\/docs\/how-to-use-fastly-with-shortpixel-adaptive-images\/"},"modified":"2025-08-27T08:39:12","modified_gmt":"2025-08-27T08:39:12","password":"","slug":"how-to-use-fastly-with-shortpixel-adaptive-images","status":"publish","type":"docs","link":"https:\/\/kb.shortpixel.com\/knowledge-base\/article\/how-to-use-fastly-with-shortpixel-adaptive-images\/","title":{"rendered":"How to use Fastly with ShortPixel Adaptive Images"},"content":{"rendered":"\n<p>To use Fastly as your CDN when&nbsp;using&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/shortpixel-adaptive-images\/\" rel=\"noopener\">ShortPixel Adaptive Images<\/a>, instead of ShortPixel&#8217;s CDN, follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create an account with Fastly if you have not already done so: <a href=\"https:\/\/www.fastly.com\/\" rel=\"noopener\">https:\/\/www.fastly.com\/<\/a><\/li>\n\n\n\n<li><p>Go to <i>Deliver > Create a Delivery service.<\/i><\/p><figure><img decoding=\"async\" style=\"width: 100%; max-width: 100%;\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-H9pAZvM44n.jpg\"><\/figure><\/li>\n\n\n\n<li><p>Name the service for better organization. Go to <i>Options > Edit service name<\/i> in the top bar and give it a better name. For example, &#8220;SPAI with Fastly&#8221;.<\/p><figure><img decoding=\"async\" style=\"width: 100%; max-width: 100%;\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-DDxF8gO9gG.jpg\"><\/figure><\/li>\n\n\n\n<li>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\u00a0<code class=\"inline-code\">img<\/code>.mywebsite.com. If <code>img<\/code> is already used by another CNAME, think of something else, like\u00a0<code class=\"inline-code\">images<\/code>.mywebsite.com or\u00a0<code class=\"inline-code\">media<\/code>.mywebsite.com.<\/li>\n\n\n\n<li><p>Assuming you have chosen <code>img<\/code>, now enter &#8220;img.mywebsite.com&#8221; as the domain.<\/p><figure><img decoding=\"async\" style=\"width: 100%; max-width: 100%;\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-EHiUlOWjsx.jpg\"><\/figure><\/li>\n\n\n\n<li><p>Go to <i>Origins<\/i>, on the left, and enter &#8220;no-cdn.shortpixel.ai&#8221; as your host.<\/p><figure><img decoding=\"async\" style=\"width: 100%; max-width: 100%;\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-VP5pfBnhLL.jpg\"><\/figure><\/li>\n\n\n\n<li><p>Activate the Service.<\/p><figure><img decoding=\"async\" style=\"width: 100%; max-width: 100%;\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-yryeudjtfN.jpg\"><\/figure><\/li>\n\n\n\n<li><p>In your DNS editor, from your domain (ask your domain provider if you don&#8217;t know where it is), add a new\u00a0<strong>CNAME<\/strong>\u00a0record\u00a0from\u00a0<code class=\"inline-code\">img.mywebsite.com<\/code> to\u00a0&#8220;n.sni.global.fastly.net&#8221;.<\/p><figure><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-uNdB6fSTfW.jpg\"><\/figure><p>Remember that\u00a0<code class=\"inline-code\">mywebsite.com<\/code> should be changed to your actual domain.<\/p><\/li>\n\n\n\n<li><strong>Wait 5 minutes<\/strong>\u00a0for your domain provider to complete all technical tasks in the background.<\/li>\n\n\n\n<li>Check with <a href=\"https:\/\/dnschecker.org\/\" rel=\"noopener\">this tool<\/a> if your CNAME is propagated correctly. If not, wait 24h-48h.<\/li>\n\n\n\n<li>Take any image URL from your website, append it to\u00a0<code class=\"inline-code\">http:\/\/img.mywebsite.com\/spai\/q_lossy+ret_wait\/<\/code> (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:\n<ol class=\"wp-block-list\">\n<li>If your website is called mywebsite.com, your new CNAME is\u00a0<code class=\"inline-code\">img.mywebsite.com<\/code>, and your sample image is\u00a0<code class=\"inline-code\">https:\/\/www.mywebsite.com\/wp-content\/uploads\/2022\/04\/image.jpg<\/code>,<\/li>\n\n\n\n<li>Try to access this URL:\u00a0<code class=\"inline-code\">http:\/\/img.mywebsite.com\/spai\/q_lossy+ret_wait\/https:\/\/mywebsite.com\/wp-content\/uploads\/2022\/04\/image.jpg<\/code><\/li>\n\n\n\n<li>Can you view it without errors? Proceed to the next step.<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li><p>Return to Fastly and go to <i>Secure > TLS Management<\/i> and click on <i>Get started<\/i>.<\/p><figure><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-Pa09pIOOkF.jpg\"><\/figure><\/li>\n\n\n\n<li><p>Add your custom subdomain (in our case &#8220;img.mywebsite.com&#8221;) and click on <i>Add<\/i>.<\/p><figure><img decoding=\"async\" style=\"width: 100%; max-width: 100%;\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-XgIJKXTlR6.jpg\"><\/figure><\/li>\n\n\n\n<li><p>Now click <i>Submit<\/i> at the bottom of the page and wait for the process to complete.<\/p><figure><img decoding=\"async\" style=\"max-width: 100%;\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-lri9eutV5i.jpg\"><\/figure><\/li>\n\n\n\n<li>You have done everything on Fastly. Now go to your WordPress website and change the API URL of ShortPixel AI.\n<ol class=\"wp-block-list\">\n<li>Go to\u00a0Settings > ShortPixel AI > Behaviour and enter\u00a0<code class=\"inline-code\">https:\/\/img.mywebsite.com\/spai<\/code> in the\u00a0<strong>API URL<\/strong>\u00a0field.<\/li>\n\n\n\n<li>Replace\u00a0<code class=\"inline-code\">mywebsite.com<\/code> with your\u00a0<strong>actual domain<\/strong>\u00a0name.<\/li>\n\n\n\n<li><p>Replace the\u00a0<code class=\"inline-code\">img<\/code> part if your subdomain is different, like configured above.<\/p><figure><img decoding=\"async\" style=\"width: 100%; max-width: 100%;\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-an7VidLp8x.jpg\"><\/figure><\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Clear your WordPress cache:\u00a0<a href=\"https:\/\/shortpixel.com\/knowledge-base\/article\/426-how-to-clear-wordpress-cache\" rel=\"noopener\">How to clear WordPress cache<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>To use Fastly as your CDN when&nbsp;using&nbsp;ShortPixel Adaptive Images, instead of ShortPixel&#8217;s CDN, follow these steps:<\/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-959","docs","type-docs","status-publish","hentry","doc_category-shortpixel-adaptive-images"],"blocksy_meta":[],"year_month":"2026-04","word_count":436,"total_views":"1791","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\/959","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=959"}],"version-history":[{"count":2,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/959\/revisions"}],"predecessor-version":[{"id":2290,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/959\/revisions\/2290"}],"wp:attachment":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/media?parent=959"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_category?post=959"},{"taxonomy":"glossaries","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/glossaries?post=959"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_tag?post=959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}