Forum Discussion

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

Redirect

So this is what I'm trying to do... We have a production webpage (virtual server/pool) with basic health monitors. We have a maintenance webpage (virtual server/pool). So the application guys want to be able to change the header on the maintenance webpage to contain the word "down" and when that happens they want the production webpage to redirect to the maintenance webpage. And flip back over when they remove the word "down."

 

 

 

Any help would be much appreciated....

 

 

 

 

  • What would I put in the alias address anyway.The actual IP of the testmaint.xyz.com website?
  • What would I put in the alias address anyway.The actual IP of the testmaint.xyz.com website?yes and alias service port should be 443.
  • Thanks SMP and nitass,

     

     

     

    I got it to work....

     

     

    Smp when you came up with the same logic I was trying I knew I was on the right track. People I work with did not agree.

     

     

    nitass thanks for the GET, i knew it was a problem and just didn't know the correct syntax.

     

     

    In the alias I put the IP address of the website and the port 443. The health monitor worked then i used reverse and lo and behold it did what i wanted.

     

     

    THANKS AGAIN!!!

     

     

  • You are welcome. However, I was thinking through my recommendation a bit, and there might be an implication you should be aware of depending on how you have it configured. Do you have two monitors on the pool, or just the maintenance monitor? If you have two monitors on the pool and are using the iRule I suggested, then if EITHER monitor fails you will get redirected to the maintenance page - not just when the maintenance monitor fails. That may not be the behavior you want. If you only apply the maintenance monitor, then it's not an issue. But if you want different behavior depending on which monitor fails, then we might need to come up with something else.
  • SMP you read my mind, my plan was to alter the irule. Strange that we think alike, kinda scary. I'm not a TCL guy, I'm a network guy and I get the logic but I don't know the code. So here is the deal

     

     

    I have two health monitors

     

     

    Health1

     

    Health2

     

     

    Here is my irule.

     

     

    when LB_FAILED {

     

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

     

    }

     

    There has got to be a way to include Health2 as being down as a criteria for when to fallback within the irule.

     

     

    I'm hoping you or Nitass can assist. Judging by Nitass's input he knows TCL like the back of his hand.

     

  • what about if using only health1 on production pool, health2 on maintenance pool and then in production irule, using "LB::status pool" command to see if maintenance pool is up or down and redirect accordingly?

     

     

    just my 2 cents.
  • So if I created another pool without a VS and called it "health_pool" (i can use the same IPs of the maintenance page pool) then use that special monitor I created to get the website "down" message which would take down the health_pool. Then, i could go to the prod pool and put in an irule. Can i reference a pool that is not the same pool as where I'm applying the irule? So what would that Irule look like under the prod pool?

     

     

    when LB_FAILED {

     

    if { [LB::status pool health_pool] eq down}{

     

    HTTP::fallback "https://testmaint.xyz.com/default.htm"
  • Can i reference a pool that is not the same pool as where I'm applying the irule? So what would that Irule look like under the prod pool? yes but i understand you also have to specify pool member.

     

     

    e.g.

     

    LB::status pool (name) member (ip) (port)

     

     

    LB::status wiki

     

    https://devcentral.f5.com/wiki/iRules.lb__status.ashx

     

     

    and you should use HTTP_REQUEST event instead of LB_FAILED since on production, it does not fail.
  • Something like this.

     

     

    when HTTP_REQUEST {

     

    if { [LB::status pool health1 member x.x.x.x 443] eq down}{

     

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

     

    }

     

    }

     

     

    or like this

     

    when HTTP_REQUEST {

     

    if { [LB::status pool health1 member x.x.x.x 443] eq down}{

     

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

     

    }

     

    }

     

     

    The only problem I worry about is with persistance. Which will happen. When I did it the other way persistance caused a problem but since I had a health monitor I was able to force a reset when the pool went down and then redirect to the new page. I won't have that option this way. Unless I can include something in this irule.

     

  • according to sol6510, i think HTTP::redirect (2nd one) is better since bigip will send http redirection immediately.

     

     

    sol6510: BIG-IP system fallback host behavior when a host is down

     

    http://support.f5.com/kb/en-us/solutions/public/6000/500/sol6510.html