Forum Discussion

Carl_Gottlieb_1's avatar
Carl_Gottlieb_1
Icon for Nimbostratus rankNimbostratus
Apr 24, 2007

irule priority with asm - version 9.2.4

On version 9.2.4 I had a virtual server, pool attached along with an irule as below, to redirect balnk uri's:

 

 

when HTTP_REQUEST {

 

if { [string length [HTTP::uri]] <= 1 } {

 

HTTP::redirect "https://www.domain.com/home"

 

}

 

}

 

 

This works fine. If I remove the default pool, and add an ASM class containing the pool to the policy, ASM works but the irule doesn't trigger.

 

 

Is there any way I can get the above rule to happen first?

 

 

Many thanks

 

Carl

2 Replies

  • SOL7041 has an example of how to handle scenarios in iRules where you want to prevent the request from going to ASM.

    https://tech.f5.com/home/solutions/sol7041.html

    Click here

    
    when HTTP_REQUEST {
      set asm_bypass 0
      if { [HTTP::uri] starts_with "/mydir" } {
        HTTP::redirect "http://www.mysite.com/myredirect"
        set asm_bypass 1
      }
    }

    You could also tweak your rule slightly, as a URI will never be 0 length. If it's 1 character, it must be "/".

    
    when HTTP_REQUEST {
        by default, don't bypass ASM
       set asm_bypass 0
       if { [HTTP::uri] eq "/" } {
           request was for / so send a redirect and disable ASM for this request
          HTTP::redirect "http://www.domain.com/home"
          set asm_bypass 1
       }
    }

    Aaron