Forum Discussion

Alexis_Bykov_13's avatar
Alexis_Bykov_13
Icon for Nimbostratus rankNimbostratus
Nov 27, 2013

How-to include IP address(es) of some balanced Web Servers into HTTP Header?

What iRules I will use to include information about IP address(es) of some balanced Web Servers into HTTP Header?

 

8 Replies

  • Hi,

    Here is an iRule to include Web servers adresses into the header.
    when HTTP_RESPONSE {
    HTTP::header insert Server_IP "[IP::server_addr]:[TCP::server_port]"
    }
    
    • Alexis_Bykov_13's avatar
      Alexis_Bykov_13
      Icon for Nimbostratus rankNimbostratus
      I need to insert this info to HTTP Header only for some servers, not for all
    • Alexis_Bykov_13's avatar
      Alexis_Bykov_13
      Icon for Nimbostratus rankNimbostratus
      Can I use following iRule for pool which has name Pool_Name?: when HTTP_RESPONSE{ if {pool } {HTTP::header insert Server_IP [IP::server_addr]} }
  • Hi,

    Here is an iRule to include Web servers adresses into the header.
    when HTTP_RESPONSE {
    HTTP::header insert Server_IP "[IP::server_addr]:[TCP::server_port]"
    }
    
    • Alexis_Bykov_13's avatar
      Alexis_Bykov_13
      Icon for Nimbostratus rankNimbostratus
      I need to insert this info to HTTP Header only for some servers, not for all
    • Alexis_Bykov_13's avatar
      Alexis_Bykov_13
      Icon for Nimbostratus rankNimbostratus
      Can I use following iRule for pool which has name Pool_Name?: when HTTP_RESPONSE{ if {pool } {HTTP::header insert Server_IP [IP::server_addr]} }
  • You can create a data group with all servers for which you want to insert this information.

    Then when your data group is created, your iRule will be :

    when HTTP_RESPONSE {
    if { [class match [IP::server_addr] equals my_ip_datagroup] } {
        HTTP::header insert Server_IP "[IP::server_addr]:[TCP::server_port]"
    }
    
  • Here is an iRule with the condition based on the pool choosen :

    when HTTP_RESPONSE {
    if { [LB::server pool] equals your_pool_name } {
        HTTP::header insert Server_IP "[IP::server_addr]:[TCP::server_port]"
    }
    

    Is your iRule going to be applied on multiple virtual servers ?