Forum Discussion

Rodrigo_N_Soare's avatar
Rodrigo_N_Soare
Icon for Nimbostratus rankNimbostratus
Apr 24, 2014

Redirect Mobile with exception HTTP::uri

Hello, I need to create a irule that detects the user-agent and redirect to mobile http://mobile.xpto.br except for some uri like "/ test". If uri contain "/test" or "/abc" in the not redirect. Can someone help me?

 

example:

 

When Http_Request { if {[class match [string tolower [HTTP :: header User-Agent]] starts_with $ group_user_agent]} { if {[string tolower [HTTP :: uri]] starts_with "/ test" or [string tolower [HTTP :: uri]] starts_with "/ abc"} { pool_Site_Corporativo pool } HTTP :: redirect "http://mobile.xpto.br" } }

 

1 Reply

  • The formatting was a bit off but pretty close nonetheless:

    when HTTP_REQUEST { 
        if { [class match [string tolower [HTTP :: header User-Agent]] starts_with group_user_agent] } { 
            if { ( [string tolower [HTTP :: uri]] starts_with "/test" ) or ( [string tolower [HTTP :: uri]] starts_with "/abc" ) } { 
                pool_Site_Corporativo pool 
            } else {
                HTTP :: redirect "http://mobile.caixaseguros.com.br" 
            } 
        }
    }