cancel
Showing results for 
Search instead for 
Did you mean: 

Display Maintenance page using Rules

Highlighted
Occasional Contributor

Display Maintenance page using Rules

Hi

Currently we have configured the maintenance page for one of the Virtual server which is hosting the URL www.healthdomain.com

and configured the Generic Customized Error single html page in Virtual server ----Connection management -----Connection Error Settings and this Maintenance  message will be displayed if any of the Pool goes down.

We have hosted so many application on the same virtual server using the different pool and using the Traffic script rules each app goes to respective pools.

Now we need to have a customized page for each application during the outage.

Is it possible to have an maintenance page for single application alone from Traffic Manager. If yes need some guidance on this.

Regards

Rajesh

6 REPLIES
Contributor

Re: Display Maintenance page using Rules

Hello Rajesh,

There are different ways to do this.

In your scenario, I think a solution could be Sending custom error pages

Let's adapt it to your situation (one per pool).

Create 1 new Virtual Server/Traffic IP Group that will be used as the Failure Pool for all the pools your VS is using.

This VS will use "discard" as Default Pool.

Upload all your different maintenance pages to the Extra Files Catalog, in the Miscellaneous section.

If you name your pages like "maintenancepage_<poolName>.html" you could then import the same pool routing logic as your production VS to serve the right Failure Pool maintenance page.

Have a look at Sending custom error pages, it holds a clear explanation of the process, especially if you need to embed files from your maintenance pages.

If we consider your current pool routing to look like:


if (condition A) {


  pool.use("foo");


} else if (condition B) {


  pool.use("bar");


} ...


else {           


   # Default pool


}


You could just translate it to:


if (condition A) {


  $pool="foo";


} else if (condition B) {


  $pool="bar";


} ...


else {           


  $pool="default";      # to match the default maintenance page file name


}




And add some logic to serve the specific pages, as instructed how here: Sending custom error pages

Just make sure to use resource.get("maintenancepage_" . $pool . ".html"); instead.

I also would advise people to use another response code than 200, because the client should be able to know not everything went well, even if it is eye candy.

Occasional Contributor

Re: Display Maintenance page using Rules

Hi

The above condition will not be applicable if we host many applications on the same Pool (Pool-All-APP). So We cant choose the failure of pool option. This will bring dow all the applications.

We need rules to take one of the application alone to Maintenance on the single pool where many app are hosted.

I tried by using this

if( string.contains( http.getrawurl(), "/App1" ) )

{

        http.addheader( "X-Info", resource.get( "maintenance.htm" ));

}

Am not success on this.

Contributor

Re: Display Maintenance page using Rules

Then instead of using a maintenance page per pool, use a page per application?

The most important documentation is Sending custom error pages

You can adapt it to your scenario. You can also duplicate pools to have one per application. Hope this helps.

Contributor

Re: Display Maintenance page using Rules

we do have some similar problem, so what we do is just trafficscript, no particular error-files, but a html-response via http.sendresponse

so, either check a whole pool via


if pool.activenodes("<yourpoolname>") == 0 {


     # send back an error via http.sendresponse(....)


}


or check a single node via


pool.checknode("<yourpool>","<yournodename>","<yourport>");


Contributor

Re: Display Maintenance page using Rules

Hi Jochen,

How do you handle the case where a request is not resendable and the pool is not seen as 100% failed (some requests fail, some don't)?

Occasional Contributor

Re: Display Maintenance page using Rules

Hi Jochen,

Currently we implemented through http.sendresponse as below by uploading custom maintenance page through extra files.

  1. if( string.contains( http.getrawurl(), "/App1" ) )
    {
    http.sendresponse( 200, "text/html", resource.get( "maintenance.htm" ), "");
    }




    Regards
    Rajesh