Forum Discussion

Amol_Khatavkar_'s avatar
Amol_Khatavkar_
Icon for Nimbostratus rankNimbostratus
Dec 16, 2014

how to create the iRule for redirecting traffic on URL context string?

2.1) I would like all web traffics that begin with the following URL context string https://192.168.10.1/YYYY* or https://10.10.10.1/YYYY* to be

 

directed to the default YYYY.YYYYY.com-https load balancer pool.

 

2.2) I would like to implement an irule redirect on all web traffics with the below listed URL context strings to redirect those web traffics to the new YYYY.WW.YYYYY.com-https pool.

 

https://192.168.10.1/WWWW- https://192.168.10.1/VVVV- https://10.10.10.1/WWWW- https://10.10.10.1/VVVV-

 

1 Reply

  • You can do this with code like the following. As long as people are accessing the URL by ip address like in your example, it should work. Otherwise, You'll need to add some additional conditions in the switch statement to handle the alternate hosts.

     

    when HTTP_REQUEST {
        switch -glob -- [string tolower "[HTTP::host][HTTP::uri]"] {
            "192.168.10.1/YYYY*" -
            "10.10.10.1/YYYY*" {
                pool YYYY.YYYYY.com-https 
            }
            "192.168.10.1/WWWW-*" -
            "10.10.10.1/WWWW-*" -
            "192.168.10.1/VVVV-*" -
            "10.10.10.1/VVVV-*" {
                pool YYYY.WW.YYYYY.com-https 
            }
        }
    }