Forum Discussion

crush09_18103's avatar
crush09_18103
Icon for Nimbostratus rankNimbostratus
Aug 30, 2012

Need help with IRULE,

So here is the scenario. We have a "production website" in one facility. We have a "maintenance website" in another facility. They want to be able to be able to change the response on a webpage within the maintenance website to "down" which will cause the "production website" to redirect to the 'maintenance website." This gives them control of when the maintenance webpage comes up. They do not want anything automatic.

 

 

So i'm thinking that the irule will have to do a get and look for a response, if "down" then redirect.

 

 

 

Is this even close? Also, I need to make sure that persistance does not keep sending people who were already connected to the production website when the redirect is supposed to be happening. Not sure how to write that.

 

 

when HTTP_REQUEST {

 

if { [GET /getwebsitestatus.aspx?env=test HTTP/1.1\r\nHost: testmaint.xyz.com\r\nConnection: close\r\n\r\n ] eq down}{

 

HTTP::redirect "https://testmaint.xyz.com/default.htm"

 

}

 

}

 

 

 

However, is there any way that "maintenance website status" could do a send to the "production website" to force the redirect.

 

 

 

 

Any help would be much appreciated.

 

 

Crush09

5 Replies

  • Hi crush09,

     

     

    You could simlify things somewhat with a custom health monitor to mark the nodes down if they change the content to "down". Then just have an iRule that monitors the Active Members. If the number of active members is zero, redirect to a sorry or maintenance page.

     

     

    This would negate the persistence since there would be no active members to persist to (and you could ensure this by adding a "persistence none" statement in the redirect to the maintenance page.

     

     

    See this post for a picture and more info on how to configure the Health Monitor (in this image example I check a specific file for the response so that the Website Owners could just change the content of one file to enable or disable an individual node to remove it from the pool, so it adds additional functionality on controlling which nodes take traffic. This would mean that they would need to change this on all nodes if they wanted to redirect the entire site to the maintenance location):

     

    Monitor receive disable and persistence

     

     

    See the Wiki Entry for active_members to see how to check the number of active members (in these examples just change the pool settings to a redirect to the maintenance or oops page location).

     

     

    Hope this helps.
  • The "down" is not on the production webpage. The "down" is on the maintenance webservers. We already tried something like you are suggesting and it does not fit their needs. I appreciate the response. Thank you.
  • The "down" is not on the production webpage. The "down" is on the maintenance webservers. We already tried something like you are suggesting and it does not fit their needs. I appreciate the response. Thank you.
  • The "down" is not on the production webpage. The "down" is on the maintenance webservers. We already tried something like you are suggesting and it does not fit their needs. I appreciate the response. Thank you.
  • A couple of options:

     

     

    1. Sideband call (v11) - not the most performant option but provides near real-time status. Add a sideband GET request in your production VIP's HTTP request

     

     

    2. Custom monitor pointed at a "dummy" pool - create a pool with fake IP and attach a custom monitor that does a cURL GET request to your maintenance site, marking the pool down if the response is "down". Then in your production iRule check the status of this pool in your HTTP request.