Forum Discussion

cxcal_18687's avatar
cxcal_18687
Icon for Nimbostratus rankNimbostratus
Jan 25, 2011

4.xto 10.x iRules

Is there any clean way of converting 4.x iRules to 10.x ?

 

 

Any help would be appreciated.

 

 

 

 

 

 

 

rule attnow {

 

redirect to "https://%h/%u"

 

}

 

rule actt_redirect {

 

if (http_uri == "/") {

 

redirect to "https://inc.com/actt/"

 

}

 

else {

 

redirect to "https://inc.com/%u"

 

}

 

}

 

rule MEVSNET {

 

if (http_host == "inc.com" and http_header("WL-Proxy-SSL") != "true") {

 

redirect to "https://inc.com/%u"

 

}

 

else if (http_host == "inc.com" and http_uri ends_with "/") {

 

redirect to "https://inc.com/index.html"

 

}

 

else if (http_host == "www.snet.com" and http_uri ends_with "/") {

 

redirect to "https://www.snet.com/index.html"

 

}

 

else if (http_host == "inc.com" and http_uri ends_with "/") {

 

redirect to "https://www.inc.com/index.html"

 

}

 

else if (http_host == "snet.com" and http_header("WL-Proxy-SSL") != "true") {

 

redirect to "https://www.snet.com/%u"

 

}

 

else if (http_host == "www.snet.com" and http_header("WL-Proxy-SSL") != "true") {

 

redirect to "https://www.snet.com/%u"

 

}

 

else if (http_host == "192.199.99.104") {

 

discard

 

}

 

else {

 

use pool SNET

 

}

 

}

 

rule Direct {

 

if (http_header("WL-Proxy-SSL") == "true" and (http_uri ends_with "router/t_fileupload" or http_uri ends_with "router/p_fileupload")) {

 

redirect to "https://inc.com/router/t_fileupload"

 

}

 

else if (http_header("WL-Proxy-SSL") != "true" and (http_uri ends_with "router/t_fileupload" or http_uri ends_with "router/p_fileupload")) {

 

redirect to "http://inc.com/router/error"

 

}

 

else if (http_header("WL-Proxy-SSL") != "true" and http_uri ends_with "/") {

 

redirect to "https://inc.com/edidirect/"

 

}

 

else if (http_header("WL-Proxy-SSL") != "true") {

 

redirect to "https://192.199.99.107/%u"

 

}

 

else {

 

use pool Direct

 

}

 

}

 

2 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    There isn't any tool to do the conversion, no, but try these:

    
    rule attnow {
       HTTP::redirect "https://[HTTP::host][HTTP::uri]"
    }
    

    
    rule actt_redirect {
      if {[HTTP::uri] == "/" } {
        HTTP::redirect "https://inc.com/actt"
      }  else {
          HTTP::redirect "https://inc.com/[HTTP::uri]"
       }
    }
    

    
    rule MEVSNET {
      switch -glob [HTTP::host] {
        "*.inc.com" {
          if {[HTTP::header exists "WL-Proxy-SSL"]} {
            HTTP::redirect "https://inc.com/[HTTP::uri]"
          } elseif {[HTTP::uri] ends_with "/"} {
            HTTP::redirect "https://inc.com/index.html"
          }
        }
        "*.snet.com" {
          if {[HTTP::header exists "WL-Proxy-SSL"]} {
            HTTP::redirect "https://www.snet.com/[HTTP::uri]"
          } elseif {[HTTP::uri] ends_with "/" } {
            HTTP::redirect "https://www.snet.com/index.html"
          }
        }
        "192.199.99.104" { discard }
        default {
          pool SNET
        }
      }
    }
    

    
    rule Direct {
      if {[HTTP::header exists "WL-Poxy-SSL"]} {
        if {([HTTP::uri] ends_with "router/t_fileupload") or ([HTTP::uri] ends_with "router/p_fileuplaod"} {
          HTTP::redirect "https://inc.com/router/t_fileupload"
          return
        }
      } else {
        if {([HTTP::uri] ends_with "router/t_fileupload") or ([HTTP::uri] ends_with "router/p_fileuplaod"} {
          HTTP::redirect "http://inc.com/router/error"
          return
        } elseif {[HTTP::uri] ends_with "/"} {
          HTTP::redirect "https://inc.com/edidirect"
          return
        } else {
          HTTP::redirect "https://192.199.99.107/[HTTP::uri]"
          return
        }
      }
      pool Direct
    }
    

    Those aren't all tested so they may need a little tweaking, but they should get you close.

    Colin
  • Thanks Gents!

     

     

    I will have to try this out this evening.

     

     

     

    Thanks.