Forum Discussion

Net_Admin_86160's avatar
Net_Admin_86160
Icon for Nimbostratus rankNimbostratus
Jul 24, 2012

Irule redirect looping

I am trying to redirect the following link

 

 

 

 

https://test.mydomain.com/webservices/rest/brand/vsd/customer/email/john.doe@johndoe.com/

 

 

the following is the irule for the redirect

 

 

elseif {[string tolower [HTTP::uri]] starts_with "/webservices/rest/brand/dataqueue/"} {

 

HTTP::redirect "http://www.mydomain.com/cgi-win/rqueue.cgi?param=[HTTP::uri]"

 

} elseif {[string tolower [HTTP::uri]] starts_with "/webservices/rest/brand/comp/"} {

 

HTTP::redirect "www.mydomain.com/cgi-win/rcref.cgi?param=[HTTP::uri]"

 

} elseif {[string tolower [HTTP::uri]] starts_with "/webservices/rest/brand/"}{

 

HTTP::redirect "http://www.mydomain.com/cgi-win/rlookup.cgi?param=[HTTP::uri]"

 

}

 

 

but this result in a loop...

 

 

http://www.mydomain.com/cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rcref.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=cgi-win/rlookup.cgi?param=/webservices/rest/brand/vsd/customer/email/john.doe@johndoe.com/

 

 

 

I am not sure what is wrong... any help is greatly appreciated . I do need this urgently ...if possible.. thanks much

 

5 Replies

  • can you show the full URL? does the www.mydomain.com host end up at this irule as well as the test.mydomain.com?
  • when HTTP_REQUEST {

     

    if {[string tolower [HTTP::uri]] contains "/data/" or [string tolower [HTTP::uri]] contains "/resources/" or [string tolower [HTTP::uri]] contains "/visitor/" or [string tolower [HTTP::uri]] contains "/hjresources/" or [string tolower [HTTP::uri]] contains "/widgets/"} {

     

    use pool WPM

     

    } elseif {[string tolower [HTTP::uri]] starts_with "/webservices/rest/brand/dataqueue/"} {

     

    HTTP::redirect "http://www.mydomain.com/cgi-win/rqueue.cgi?param=[HTTP::uri]"

     

    } elseif {[string tolower [HTTP::uri]] starts_with "/webservices/rest/brand/comp/"} {

     

    HTTP::redirect "www.mydomain.com/cgi-win/rcref.cgi?param=[HTTP::uri]"

     

    } elseif {[string tolower [HTTP::uri]] starts_with "/webservices/rest/brand/"}{

     

    HTTP::redirect "http://www.mydomain.com/cgi-win/rlookup.cgi?param=[HTTP::uri]"

     

    } elseif {[string tolower [HTTP::uri]] contains "/cwpm/"} {

     

    use pool WPM2

     

    } elseif {[string tolower [HTTP::uri]] contains "/rw37"} {

     

    HTTP::redirect "http://www.mydomain.com/cgi-win/excn.cgi?login&mode=comp&P=RW37"

     

    } elseif {[string tolower [HTTP::uri]] contains "/na37"} {

     

    HTTP::redirect "http://www.mydomain.com/cgi-win/excn.cgi?login&mode=comp&p=NA37"

     

    } elseif {[string tolower [HTTP::uri]] contains "/dc25"} {

     

    HTTP::redirect "https://biw.mydomain.com/cgi-win/biw.cgi?mode=paidlogin&t=dc25"

     

    } elseif {[string tolower [HTTP::uri]] contains "/dc30"} {

     

    HTTP::redirect "https://biw.mydomain.com/cgi-win/biw.cgi?mode=paidlogin&t=dc30"

     

    } elseif {[string tolower [HTTP::uri]] contains "/oiq" and not ([string tolower [HTTP::uri]] contains "/rest/brand/oiq/")} {

     

    HTTP::redirect "https://test.mydomain.com/data/[HTTP::uri]"

     

    } elseif {([string tolower [HTTP::uri]] contains "/ec/" or [string tolower [HTTP::uri]] contains "/ecn") and not ([string tolower [HTTP::uri]] contains "/rest/brand/ecn/")} {

     

    HTTP::redirect "https://ne.mydomain.com/data/ecn"

     

    } else {

     

    use pool WEBSERVERS

     

    }

     

    }
  • i think it must have something else besides this irule which causes looping.

    [root@ve10:Active] config  b virtual bar list
    virtual bar {
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
       if {[string tolower [HTTP::uri]] contains "/data/" or [string tolower [HTTP::uri]] contains "/resources/" or [string tolower [HTTP::uri]] contains "/visitor/" or [string tolower [HTTP::uri]] contains "/hjresources/" or [string tolower [HTTP::uri]] contains "/widgets/"} {
          pool WPM
       } elseif {[string tolower [HTTP::uri]] starts_with "/webservices/rest/brand/dataqueue/"} {
          HTTP::redirect "http://www.mydomain.com/cgi-win/rqueue.cgi?param=[HTTP::uri]"
       } elseif {[string tolower [HTTP::uri]] starts_with "/webservices/rest/brand/comp/"} {
          HTTP::redirect "www.mydomain.com/cgi-win/rcref.cgi?param=[HTTP::uri]"
       } elseif {[string tolower [HTTP::uri]] starts_with "/webservices/rest/brand/"}{
          HTTP::redirect "http://www.mydomain.com/cgi-win/rlookup.cgi?param=[HTTP::uri]"
       }  elseif {[string tolower [HTTP::uri]] contains "/cwpm/"} {
          pool WPM2
       } elseif {[string tolower [HTTP::uri]] contains "/rw37"} {
          HTTP::redirect "http://www.mydomain.com/cgi-win/excn.cgi?login&mode=comp&P=RW37"
       } elseif {[string tolower [HTTP::uri]] contains "/na37"} {
          HTTP::redirect "http://www.mydomain.com/cgi-win/excn.cgi?login&mode=comp&p=NA37"
       } elseif {[string tolower [HTTP::uri]] contains "/dc25"} {
          HTTP::redirect "https://biw.mydomain.com/cgi-win/biw.cgi?mode=paidlogin&t=dc25"
       } elseif {[string tolower [HTTP::uri]] contains "/dc30"} {
          HTTP::redirect "https://biw.mydomain.com/cgi-win/biw.cgi?mode=paidlogin&t=dc30"
       } elseif {[string tolower [HTTP::uri]] contains "/oiq" and not ([string tolower [HTTP::uri]] contains "/rest/brand/oiq/")} {
          HTTP::redirect "https://test.mydomain.com/data/[HTTP::uri]"
       } elseif {([string tolower [HTTP::uri]] contains "/ec/" or [string tolower [HTTP::uri]] contains "/ecn") and not ([string tolower [HTTP::uri]] contains "/rest/brand/ecn/")} {
          HTTP::redirect "https://ne.mydomain.com/data/ecn"
       } else {
          pool WEBSERVERS
       }
    }
    }
    
    [root@ve10:Active] config  curl -I http://172.28.19.79/webservices/rest/brand/vsd/customer/email/john.doe@johndoe.com/ -H "Host: www.mydomain.com"
    HTTP/1.0 302 Found
    Location: http://www.mydomain.com/cgi-win/rlookup.cgi?param=/webservices/rest/brand/vsd/customer/email/john.doe@johndoe.com/
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    
  • Thank you so much ... finally figured it out esp after your reponse. The issue was

     

     

     

     

    test.mydomain.com - new LB

     

    www.mydomain.com ---old LB

     

    we have been migrating from a old f5 LB to new f5 LBs and a much larger version of this irule was sitting on the old LB ... so once the rule passed the first time on the new LB (irule) it would then be handed over to the old LB where it would run through the irule there..where instead of "starts_with" the old version had "contains". thus causing the loop. Have removed this section of the code from the old irule... and all works good now...