Forum Discussion

RJ_77653's avatar
RJ_77653
Icon for Nimbostratus rankNimbostratus
May 29, 2013

Need help writing an Irule for a CSS to F5 migrationi

We currently have 2 url's pointed to 1 Virtual IP, if the url contains "thelinkrpts" it will forward to pool a which conatains two servers. But if the url contains "infoview", it gets forwarded to another pool, and redirected to servername that it is load balanced to and a uri "servername"/businessobjects/enterprise115/InfoView/default.htm .

 

 

So if I have server1 and server2 int the pool

 

 

if it gets lb to server1 we need to redirect to

 

server1/businessobjects/enterprise115/InfoView/default.htm

 

 

if it gets lb to server2 we need to redirect to

 

server2/businessobjects/enterprise115/InfoView/default.htm

 

 

I have been working on this and cant quite get it working. Thanks for your help.

 

6 Replies

  • check this out:

     

     

    https://devcentral.f5.com/tech-tips/articles/routing-traffic-by-uri-using-irule

     

     

  • Thanks for the help, but that really was not what I was looking for. Really need to get the redirect at the node level here is the css config

     

     

    Service is the node

     

     

    service crystal-sw-crystalpr04-HO/DC

     

    redirect-string "sw-crystalpr04/businessobjects/enterprise115/InfoView/default.htm"

     

     

    Content is the virtual server

     

     

    content crystal-prd-VM-HO/DC-redirect

     

    vip address 10.1.4.25

     

    redundant-index 15

     

    add service crystal-sw-crystalpr04-HO/DC

     

    add service crystal-sw-crystalpr06-HO/DC

     

    advanced-balance sticky-srcip

     

    flow-timeout-multiplier 75

     

    primarySorryServer crystal-sw-crystalpr05-HO/DC-FO

     

    protocol tcp

     

    port 80

     

    url "//businessobjects-infoview/*"

     

    active

     

     

     

     

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus
    Are you saying that you need to redirect to another URL or that you want to select a specific node in the pool?

     

     

    Just an observation: if the servers each serve a separate and distinct purpose I would consider using separate pools, if not separate VIPs. Otherwise your monitoring could easily lead to unexpected problems.
  • I am going to set them up on 2 VIP's, to make it easier, but for the challenging one I just need to load balance to the two servers, but I also need it to redirected to

     

     

    So the VIP points to server1 and server2 and I need the redirect to be

     

     

    server1/businessobjects/enterprise115/InfoView/default.htm when it is sent to server1

     

     

    server2/businessobjects/enterprise115/InfoView/default.htm when it is sent to server2

     

     

     

    Thanks again for the help!

     

     

  • I am going to set them up on 2 VIP's, to make it easier, but for the challenging one I just need to load balance to the two servers, but I also need it to redirected to

     

     

    So the VIP points to server1 and server2 and I need the redirect to be

     

     

    server1/businessobjects/enterprise115/InfoView/default.htm when it is sent to server1

     

     

    server2/businessobjects/enterprise115/InfoView/default.htm when it is sent to server2

     

     

     

    Thanks again for the help!

     

     

  • When you say redirect, do you mean that you want to send an HTTP Redirect to the client to point to the actual server? ie the server is not located behind the BIG-IP, the BIG-IP is just doing smart redirecting?

    Or maybe the BIG-IP redirects to the new URL on a different VS on the BIG-IP that then load balances to pool A?

    From your original post it seems that what you want to do is look at the incoming URI and if it contains X then send to server A and modify the URI to be XYZ.

    In pseudocode this would be:

    when HTTP_REQUEST
    
    if HTTP::URI contains "thelinkrpts"
     then   
            pool A
            URI replace with "/businessobjects/enterprise115/InfoView/default.htm"
    elseif HTTP::URI contains "infoview"
     then   
            pool B
            URI replace with "/businessobjects/enterprise115/InfoView/default.htm"
    else
            pool C
    endif