Forum Discussion

Albert__Tase_70's avatar
Albert__Tase_70
Icon for Nimbostratus rankNimbostratus
May 18, 2007

need help on making an irule to check header

hope someone can help I need an irule to check the header for "NPG_SRC_ADDR" if its not in the header then insert it in the header and to include the client ip address I gone through the docs have been unablke to find the right syntax

 

in version 4 I used http profile but cannot do that in version 9 do to it being moved to the virtual so have to add it to an irule the logic is simple if "NPG_SRC_ADDR" is in the header go to a pool if not then insert it into the header and the clients ip address and go to the same pool issue is can't find the right commands to do it.

 

so if any one can help it would be appreaicated

 

 

Whats used to check header for spefic info

 

whats use to insert info into header including the client ip adress ?

 

 

 

thanks

 

 

Al

 

1 Reply

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    To check a header for specific info you would use the HTTP::header command.

    The logic would look something like:

    
    when HTTP_REQUEST {
      if { [HTTP::header exists "NPG_SRC_ADDR"] } {
        pool httpPool
      } else {
        HTTP::header insert "NPG_SRC_ADDR" [IP::client_addr]
      }
    }

    HTH,

    Colin