Forum Discussion

Black_Shamrock_'s avatar
Black_Shamrock_
Icon for Nimbostratus rankNimbostratus
Jan 10, 2017

LTM HTTP conditional (text check) re-direct

Our app admins want LTM to re-direct if a keyword is placed on the webpage. I'm looking for how to set up a pool with conditional re-direct. As I am less familiar with tmos, GUI screenshots would be helpful but not necessary.

 

  1. User->HTTP request to VIP-> (which sends to ). 2a. If returns 2xx status AND does not have "TEXT1" on page, then STOP. 2b. If returns 2xx status AND does have "TEXT1" text on page, then redirect to .

If condition 2b is met, send request to AND check for "TEXT2". 3a. If contains "TEXT2", then STOP. 3b. If does not contain "TEXT2", then redirect to . Then STOP.

 

Can I accomplish this via a single policy, or do I need to use an alternate method/multiple policies or monitors. Thank you in advance.

 

3 Replies

  • I'd like to to advice not to go this way.

     

    • Is it possible for the app admins to add a header instead of content? That'd use far less resources.
    • What is the redirect used for? Some maintenance/sorry page? If so there are better ways.

    /Patrik

     

  • Yes- the purpose is allowing the app admins to redirect users of the webpage without varying down HTTP services. I have to operate in the constraint of the webpage owner putting a text within the webpage of "TEXT1" to cause the re-direct to occur.

     

  • Given the circumstances above and assuming that the whole site would need redirection I would:

    1. Create an HTTP monitor with a receive disable string of TEXT1 leaving the other fields blank.
    2. Add this as an additional monitor to the pool.

    Then either:

    Create this irule and assign it to the vip.

    when LB_FAILED {
        HTTP::respond 302 Location "https://myuri"
    }
    

    Or use a fallback host in the HTTP profile of the vip (essentially the same thing).

    Disclaimer:

    I personally don't like using redirects as maintenance/sorry pages as it in most cases sends the user to a completely different service. Using uri rewrites would enable the users browser to stay on the same url which would make it possible for him/her to hit F5 to check whether the maintenance is lifted or not.

    Patrik