Forum Discussion

Kalpesh_48932's avatar
Kalpesh_48932
Icon for Nimbostratus rankNimbostratus
Oct 01, 2012

F5 Redirection

Hello Friends,

 

Here again I need your help to create irule. a New query

 

 

Those two servers handled several application connection string

 

http://ABC@abc.com/integration-mag-it

 

http://ABC@abc.com/integration-mag-ppc

 

http://ABC@abc.com/integration-mag-hpm

 

http://ABC@abc.com/integration-mag-csg

 

http://ABC@abc.com/integration-mag-delegations

 

http://ABC@abc.com/integration-mag-china

 

http://ABC@abc.com/integration-mag-vitrage

 

 

The goal of my request is that

 

-in case of failure of everything (both web servers are not responding), the users are redirected to sorry page. Currently it works (irule implemented)

 

-in case of failure of a particular database (let say China for example), just http://ABC@abc.com/integration-mag-china will not work, all others URL will work.

 

In that case, users connecting to this Url should get redirected to Sorry page (Right now users are getting error 503 i.e webpage not found)

 

 

So the main goal is. If one of the database or link is DOWN and all other are working fine, user connecting to that FAIL link or database should be redirected to Sorry page

 

7 Replies

  • may we check http status and make redirection?

     

     

    HTTP::status

     

    https://devcentral.f5.com/wiki/iRules.http__status.ashx
  • Hi Nitass,

     

     

    thanks for suggestion. But will it work for all pools called in one irule. or i will require to create seperate irule for seperate pool.
  • i thought you have 1 virtual server with 1 pool containing 2 servers and when 1 url is not working (e.g. /integration-mag-china), that url on both servers are not working (since both servers may connect to same external resource).

     

     

    so, i think we just assign the http status irule to the virtual server.

     

     

    please let me know if i misunderstood anything here.
  •  

    Hi Nitass,

     

     

    you are right. this is the case. Pool members containg multiple database, so if one of the DB goes down and even server is UP with same service, it should be detected by irule and redirection should work
  • Hi Nitass, http status irule link given is actually not working. can you please tell me which irule to be setup, it gives some syntax error
  • e.g.

    [root@ve10:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve10:Active] config  b pool foo list
    pool foo {
       members 200.200.200.101:80 {}
    }
    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when HTTP_RESPONSE {
       if {[HTTP::status] == 503} {
          HTTP::redirect "http://www.google.com"
       }
    }
    }
    
     on client
    
    [root@centos251 ~] curl -I http://172.28.19.79
    HTTP/1.0 302 Found
    Location: http://www.google.com
    Server: BigIP
    Connection: close
    Content-Length: 0
    
     on bigip
    
    [root@ve10:Active] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 172.28.19.251(49585) <-> 172.28.19.79(80)
    1349270493.5390 (0.0010)  C>S
    ---------------------------------------------------------------
    HEAD / HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Host: 172.28.19.79
    Accept: */*
    
    ---------------------------------------------------------------
    
    New TCP connection 2: 200.200.200.10(49585) <-> 200.200.200.101(80)
    1349270493.5401 (0.0009)  C>S
    ---------------------------------------------------------------
    HEAD / HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Host: 172.28.19.79
    Accept: */*
    
    ---------------------------------------------------------------
    
    1349270493.5422 (0.0021)  S>C
    ---------------------------------------------------------------
    HTTP/1.1 503 Service Temporarily Unavailable
    Date: Wed, 03 Oct 2012 13:37:49 GMT
    Server: Apache/2.2.3 (CentOS)
    Retry-After: 18000
    Connection: close
    Content-Type: text/html; charset=iso-8859-1
    
    ---------------------------------------------------------------
    
    1349270493.5423 (0.0032)  S>C
    ---------------------------------------------------------------
    HTTP/1.0 302 Found
    Location: http://www.google.com
    Server: BigIP
    Connection: close
    Content-Length: 0
    
    ------------------------------------------------------