For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

bbensten_8485's avatar
bbensten_8485
Icon for Nimbostratus rankNimbostratus
Feb 28, 2014

Irule to read cookie value of amlbcookie

I have a syntax error with this irule that I cant figure out for the life of me. Can someone help? I am attempting to take connections in with a cookie called "amlbcookie" and then based on the vale 1 or 3 pass to specific nodes and then if not, send it to the default pool.

when HTTP_REQUEST { if { [HTTP::cookie exists "amlbcookie"] } { log local0. "[HTTP::cookie "amlbcookie"]" switch -glob [HTTP::cookie "amlbcookie"] { 01 { node 10.29.35.111 log local0. "matched 01" } 03 {

node 10.29.35.112

log local0. "matched 03” }
   } 
} 
else { 
   pool Auth_SSL_Offload 
   log local0. "default" 
} 

}

1 Reply

  • Minor syntax correction:

    when HTTP_REQUEST { 
        if { [HTTP::cookie exists amlbcookie] } { 
            log local0. [HTTP::cookie value amlbcookie] 
            switch [HTTP::cookie value amlbcookie] { 
                "01" { 
                    node 10.29.35.111 80
                    log local0. "matched 01" 
                } 
                "03" {
                    node 10.29.35.112 80
                    log local0. "matched 03" 
                }
            } 
        } else { 
            pool Auth_SSL_Offload 
            log local0. "default" 
        } 
    }
    

    You need to specify the port when issuing a node command.