CDNs can give a big boost to the speed of your website as they keep a cached version of your assets on the edge and them being spread all over the globe, they are faster as they route the request to the closest and fastest server.
Setting Up a CDN
CDN URL is something that your CDN provider provides, and Origin URL is the URL of your main server like https://speedycache.com in our case.
Here we are assuming that you have already uploaded your files to the CDN Storage. To integrate a CDN follow the steps below:-
CDN Storage
There are a few things you need to keep in mind about folder structure while uploading your files to a CDN.
The structure of the folder on CDN storage should be exactly like how it is on WordPress.
For Example:-
https://speedycache.com/wp-content/uploads/2022/03/speedycache-cdn.png is the URL of an image and it gets rewritten as https://somecdn.com/wp-content/uploads/2022/03/speedycache-cdn.png
So the Folder Structure on the CDN should be wp-uploads/uploads/2022/03/speedycache-cdn.png. If the folder structure on your CDN storage is not as your WordPress install, then the CDN won't be able to serve the image and it would result in a broken image.