Recently I noticed that my little blog has traffic all over the world, which is amazing! I can imagine however that they user experience cannot be equally amazing in places far far away from where my host is located. Luckily this is easy to fix, with a Content Delivery Network (CDN).
To quickly explain what a CDN is, I asked ChatGPT and here is the response I got:
A CDN, or Content Delivery Network, is a system of servers that are used to deliver content to users based on their geographic location. CDNs are often used to deliver web content, such as images, videos, and other types of media, to users in a fast and efficient manner.
CDNs work by replicating the content they are serving on servers located in different parts of the world. When a user requests content from a CDN, the CDN uses algorithms to determine the user’s location and then delivers the content from the server that is geographically closest to the user. This helps to reduce the time it takes to deliver the content and can improve the user experience by providing faster loading times.
CDNs can be used to deliver content for websites, mobile apps, and other types of online applications. They are particularly useful for serving content to users who are located far from the origin server, as it can take a long time for content to be delivered over long distances. CDNs can also help to reduce the load on the origin server and improve the overall performance of a website or application.
My blog is built on wordpress and I use the WP Rocket plugin for performance boost, which makes my life very easy, by allowing me to use whichever CDN-endpoint I please, and as you can imagine, I please Azure!
Creating a CDN on Azure is ridiculously easy, it only takes a few clicks.
First, pick the Azure Front Door and CDN Profiles resource from the Marketplace. Make sure you have Microsoft.Cdn enabled in your subscription’s resource providers, if this bad boy doesn’t show up.
After that, just pick the default options, I need nothing more than what the Quick create-option provides. Take a look on the other offerings if you wish but it’s mostly legacy options, or as Azure calls them, “classic”.
The only options that need special attention afterwards, are:
- Origin Type. AFD supports a plethora of Azure Services but since my blog isn’t hosted on Azure, I picked the Custom option and then entered my host-name.
- Query string caching behavior refers to the way AFD will cache content behind various endpoints. I didn’t need to change anything there either but it’s nice to know that it is possible.
That’s it! The CDN is now ready and I can even see the endpoint that has been created for me.
This endpoint is then put in the CDN-section of WP rocket.