Most people start off using Traffic Manager to improve the availability and reliability of a website, then focus on how they can improve its performance and response time, but Traffic <anager really starts to shine when you discover how easy it is to enhance the presentation of your website, control how customers access content, and the manage the service that customers receive.
In this simple example, we’ll show how Traffic Manager can detect error messages generated by a website, and then conceal those from the end user. Our example website is based on a simple content management system (CMS). If you happen to give it a valid link and CMS doesn't have a nice simple error page, it just sends out a plain error message saying "No articles match your search criteria."
So, imagine that you don't have admin access to our CMS: so you can't edit the CMS to change this error message or substitute a different page. But what we can do is intercept this error message as it is served back through the traffic manager, and redirect the user to a different page in the website. We can do that easily using TrafficScript programming language on Traffic Manager.
Rules on Traffic Manager are very straightforward. If you're familiar with any sort of imperative procedural programming language, then you'll pick up TrafficScript very, very quickly:
This short piece of TrafficScript does three things:
If the request isn't a web document, then stop running it through.
Otherwise, grab the request.
If it contains this error message, then re-direct the user to a nice internal error page instead
If we turn that rule on, and then, when we reload this page, rather than getting the unpleasant "No articles match your search criteria," we can redirect to a nicer-looking error page that we created beforehand. In the same way, we can intercept other aspects of a web page, redirect URLs based on the type of content, the requested URL, or even the time of day.