A simple failover system to recover website when CDN fails

Its always a good idea to keep your images, css etc files on a server which can serve faster on top can server from nearest location which typically is the definition of a CDN or Content Deliver Network. Using CDN not only speeds up your website but also helps you in getting up in search result after it was included as one of the signals in SERP.

However there is one disadvantage that comes along with it. In case the CDN fails your site turns into a pure text because without Stylesheet and Images it is almost impossible to give an excellent user experience. In this post I will talk about creating a simple failover system which can help you in this kind of scenario but this is not automatic.

  • Have all your images in a sub domain which is on your server e.g. imgstore.yoursite.com.
  • Assuming you have a CDN, keep both your CDN and Image subdomain exactly the same. If you are using a PULL zone it works out of the box.
  • To work with CDN you must have a CNAME which will point to your CDN. Its more like a “good looking, feel on your server” URL. e.g. images.yoursite.com which points to CDN URL which can be like  images.yoursite.somecdn.com.
  • So when you are adding an image url in your webpage it is http:// image.yoursite.com/yourlogo.png which converts to http://images.yoursite.somecdn.com/yourlogo.png
  •  Now when the CDN goes down, http://images.yoursite.somecdn.com/yourlogo.png becomes unavailable and so will http:// image.yoursite.com/yourlogo.png.  Time for Action.!
Simple CDN Failover System
Simple CDN Failover System
  • Now to failover system to work, change your CNAME to point to your image server directly to imgstore.yoursite.com.
  • Since you have kept files etc all in sync and same structure the images, style sheet etc will start displaying again.

Thats it. These simple steps can help you in case of disasters though a good CDN will fail rarely.


Please enter your comment!
Please enter your name here