Autoptimize + SPAI + own CDN
-
Hello. So I’ve been trying to follow the settings as described here https://shortpixel.helpscoutdocs.com/article/76-can-i-use-a-different-cdn-with-your-service – but I might be doing something wrong as the images are still served through Shortpixel’s CDN.
Assuming my CDN URL is https://my-cdn-name.kinstacdn.com, Could you please confirm if these are the correct steps?
1. In SPAI settings, change the API URL to https://my-cdn-name.kinstacdn.com/spai (so I have to include ‘spai’ at the end, correct?)
2. Add the following code snippet for Autoptimize:
add_filter(‘autoptimize_filter_extra_imgopt_base_url’,’use_my_own_cdn’);
function use_my_own_cdn($urlIn) {
return str_replace(‘cdn.shortpixel.ai’,’my-cdn-name.kinstacdn.com’,$urlIn);
}3. Add the CNAME record (I’m using Google Domains)
CNAME / my-cdn-name.kinstacdn.com / no-cdn.shortpixel.ai / 1hIs that it?
Thanks!
- The topic ‘Autoptimize + SPAI + own CDN’ is closed to new replies.