Forum Discussion

Mark_58201's avatar
Mark_58201
Icon for Nimbostratus rankNimbostratus
Dec 29, 2008

Redirect to another Website Irule Problem

I'm very new to writing iRules. We have BigIp's with v4.5.11 Build 147. What we would like to do is the following:

 

Two web servers are both down, or the backend database is down which is served by a Legato virtual address; if one or the other case occurs, we want the user directed to a "site under maintenance" page on another web server. I would imagine that the rule would involve checking whatever variable indicates that the nodes are down and including that in if-then-else statements. Lastly, what references does the DevCentral have that would be good for my learning more about writing iRules. Thanks.

 

 

Mark

6 Replies

  • Hi Mark,

     

     

    I don't think there is a way to determine the number of active pool members in 4.x. You can configure a fallback host on the pool though so that BIG-IP will send a redirect to the client if the connection to the pool fails. Another option would be to configure a lower priority member (or members) to send the requests to if the higher priority members are not available.

     

     

    See SOL7051 (Click here) for details on these two options.

     

     

    Aaron
  • Aaron,

     

    Thank for you the reply and information. I've been trying to get this to work with the fallback host info you gave me but have not had success. Within the pool, I set the Minimum Active Members field to 1 (we have 2 web server members). I then added the IP address of the the fallback web server, which is also on our dmz, to the Fallback Host field. So the scenario, as I understand it, would be for an outsider to go to www.mysite.com, whose nodes are both down because I unplugged them. The BigIp should then send the request to the ip addess fallback server xxx.xxx.xxx, and that page should be displayed. Unfortunately, all I get is "page cannot be displayed" and the url address field still shows the www.mysite.com address. I have a feeling that either I set something up wrong, or there may be a problem with the fallback server being on our dmz just as the original web servers are. Any insight into this would be appreciated. Thanks.

     

     

    Mark
  • Hi Mark,

     

     

    The fallback host should be a fully qualified URL (like http://sorry.example.com/outage.html). It should not resolve to the same IP address as the VIP or you'd get constant redirections. If you use lower priority pool members instead of a fallback host, and no higher priority members are available, the requests would be sent unchanged to the lower priority pool members. The lower priority servers would need to be configured to answer for the same URI's as the main servers--or serve "sorry" content for all requests.

     

     

    Does it sound like either option will work for you?

     

     

    Aaron
  • Aaron,

     

    Basically what I am trying to do is have BigIp fallback to a webserver that displays the page "sorry - site under maintenance" - when the 2 member webservers are both down. In my reading, I thought the fallback server could be either the ip address or the FQDN. I will get the FQDN of the fallback server and try it again. All these servers are NOT in a domain but in a workgroup and on ou DMZ. Thanks.

     

     

    Mark
  • Aaron - Progress! It came down to the fact that the site we are dealing with is an https site, not http, and as soon as we put in a fallback host that is an https site it worked. So we have to figure out how to send it to an http-only site, if that is possible. One other thing we would like to do is to send the request to the same "sorry - under maintenance" site when the backend database is down, which is a SQL server database running on a Legato pair that uses a virtual ip address. That I think might take an iRule. Thanks for all your help.

     

     

    Mark
  • If the main pool members are using SSL re-encryption, then the lower priority pool members will also need to accept HTTPS connections in order to accept the BIG-IP connections. I can't see a way around this as you cannon dynamically disable encryption within a single pool if the higher priority members are down.

     

     

    As far as redirecting if the database is down, here is the logic I'd use in 9.x. I don't have a 4.x box to look at to confirm this is possible in 4.x, but I think it's possible. You could create a page on the higher priority members which generates an UP message in the response body if that web server is able to talk with the database. If the connection from the web server to the db goes down, or the server can't get a valid response from the DB it would display a DOWN message for the monitor page. You could then configure a BIG-IP monitor to check the specific page on the web server for an UP message. You'd want to associate the monitor with just the higher priority pool members so that if the DB is down, the higher priority members will be marked down.

     

     

    Aaron