Stingray: Fixing errors on a website with Stingray

May 08, 2014 - by Paul Wallace, Riverbed

If you have missed the other posts in this series you can review them here prior to diving into this one.

Most people start off using Riverbed Stingray Traffic Manager to improve the availability and reliability of a website, then focus on how they can improve its performance and response time, but Stingray really starts to shine when you discover how easy it is to enhance the presentation of your website, control how customers access content, and then manage the service that customers receive. In this simple example, we’ll show how Stingray 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 Riverbed Stingray Traffic Manager.

Rules on Stingray 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:

  1. If the request isn't a web document, then stop running it through.
  2. Otherwise, grab the request.
  3. 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.