Feature request - CDN url replace

I just implemented a CDN on my Wordpress blog and its working fine on the regular wordpress website but the REST API is still sending the old urls for images on the frontity website.

For our purposes, we will only be using the CDN for images and maybe Font files. So perhaps we can implement something in the frontity.settings.js file that will replace all instances of old ‘wp-content/uploads/*’ urls to a cdn url?

SOmething that will globally replace all



cdn.wordpress.com/wp-content/uploads* or whatever the cdn url is?

cdn_replace : {
old_url: domain.com/wp-content/uploads
new_url: cdnurl.com/wp-content/uploads

Uhm… maybe you can do it with an Html2React processor:

const imageCdn = {
  test: node => node.component === "img",
  priority: 9, // Use a higher priority than the other image processor
  process: node => {
    node.src = node.src.replace(/domain.com/g, "cdnurl.com");
    node.srcSet = node.srcSet.replace(/domain.com/g, "cdnurl.com");
export default {
  libraries: {
    html2react: {
      processors: [image, imageCdn]

Which CDN plugin are you using? It should change the URLs in the REST API…

1 Like

By the way, we have tested the Jetpack’s image CDN and it works great and it’s free. You don’t need to add anything in Frontity, it just works: https://jetpack.com/support/site-accelerator/

I think it’s going to be the one we start recommending.

1 Like

I am using Bunnycdn and their plugin doesn’t change the REST api urls

Let me try jetpack and I will report back.


1 Like