Forum Discussion

AjayPra_161698's avatar
AjayPra_161698
Icon for Nimbostratus rankNimbostratus
Jan 07, 2015

Http traffic redirection with irule

Scenario: Nodes:Node1,Node2,Node3

Pool1:Node1,Node2

Pool2:Node3

Virtual Server:ABC

VIP 1.1.1.1

Port any

irule on VS

when HTTP_REQUEST {

set uagent [string tolower [HTTP::header User-Agent]]

if { $uagent contains "msie6" or $uagent contains "msie7" or $uagent contains "msie8" or $uagent contains "mozilla/4.0"}{

pool pool1

} else {

pool pool2

} }

With this configuration does the https traffic to VS will be affected by irule or just the http traffic

6 Replies

  • Yes. The iRule will affect all http traffic (http and https both). I would also suggest changing your

    if
    to a
    switch
    statement, since it's a little cleaner, especially if you plan to add more options in the future. (Just a thought)

    when HTTP_REQUEST {
        switch -glob -- [string tolower [HTTP::header value User-Agent]] {
            "*msie6*" -
            "*msie7*" -
            "*msie8*" -
            "*mozilla/4.0*" {
                pool pool1
            default {
                pool pool2
            }
        }
    }
    
  • The comments don't format links and stuff the same as 'answers', so I'll answer your question like this.

     

    Here are a couple links to API documentation for how to do HTTP actions within an iRule:

     

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    not sure this will work with your VS configuration for https traffic. You need a clientssl profile to decrypt the ssl traffic so the bigip can read the http data (headers etc.). But if you add a clientssl profile then port 80 traffic won't work. N
    • nitass's avatar
      nitass
      Icon for Employee rankEmployee
      it should but you have to do ssl offloading. without ssl offloading, bigip can't see http header (because it is encrypted).