Forum Discussion

sandy16's avatar
sandy16
Icon for Altostratus rankAltostratus
Apr 25, 2016

Irule help for a VS without default pool assigned.

Hi experts, need some help in the below irule. Idea is to allow traffic to the VS if there is a custom header in the request. But i found out that there is NO default Pool assigned to the VS since there is a LTM Policy attached that is doing uri-based redirections to different Pools. What should i use instead of "pool default" to allow traffic?

 

when HTTP_REQUEST {

 

Check if http_header contains the custom header

if { [HTTP::header exists "Customheader"] and ([HTTP::header "Customeheader"] contains "CF53DD5F68BBFC30DFTG5A31A8A41B8AS") } { pool default

 

if neither value matches drop traffic

} else { drop } }

 

8 Replies

  • Hello,

    You should use :

    pool /partition/pool_name

    or alternatively

    node ip_addr port_number

    • sandy16's avatar
      sandy16
      Icon for Altostratus rankAltostratus
      Thanks Yann, idea is to pass the request if header is there and drop if not. I need to use something generic, like "accept" as the action. But that gives an error of undefined procedure. I dont need to be specific as mentioning the pool or node name as that contradicts the LTM policy applied to the vs.
  • Hello,

    You should use :

    pool /partition/pool_name

    or alternatively

    node ip_addr port_number

    • sandy16's avatar
      sandy16
      Icon for Altostratus rankAltostratus
      Thanks Yann, idea is to pass the request if header is there and drop if not. I need to use something generic, like "accept" as the action. But that gives an error of undefined procedure. I dont need to be specific as mentioning the pool or node name as that contradicts the LTM policy applied to the vs.
  • Hello,

    You can do the following :

    when HTTP_REQUEST {
        if { [HTTP::header exists "Customheader"] and ([HTTP::header "Customheader"] contains  "CF53DD5F68BBFC30DFTG5A31A8A41B8AS") } {
             do nothing
        } else { 
            reject
        } 
    }
    

    or you can negate the if condition :

    when HTTP_REQUEST {
        if { !([HTTP::header exists "Customheader"] and ([HTTP::header "Customheader"] contains  "CF53DD5F68BBFC30DFTG5A31A8A41B8AS")) } {
            reject
        } 
    }
    
  • Hello,

    You can do the following :

    when HTTP_REQUEST {
        if { [HTTP::header exists "Customheader"] and ([HTTP::header "Customheader"] contains  "CF53DD5F68BBFC30DFTG5A31A8A41B8AS") } {
             do nothing
        } else { 
            reject
        } 
    }
    

    or you can negate the if condition :

    when HTTP_REQUEST {
        if { !([HTTP::header exists "Customheader"] and ([HTTP::header "Customheader"] contains  "CF53DD5F68BBFC30DFTG5A31A8A41B8AS")) } {
            reject
        } 
    }