Add Server ID in Response Header

I’ve 4 app servers running behind the LTM. I was able to insert server’s IP address and port number with the following iRule.

when HTTP_RESPONSE {

HTTP::header insert SERVER_ADDRESS "[IP::server_addr]:[TCP::server_port]"

}

But I don’t want to pass my server’s IP address and port number. Since LTM already identify the pool members so is there any way I can insert a server ID into the response header?

Thanks,

Shuvo

Where would the server ID come from? Is it an arbitrary value? If so you may want to consider a simple data group lookup method (ex. server IP := server ID).

How would LTM ID’ed the pool members? By numbers or by IP address?

Can I insert node1, node2 etc?

Off the top of my head I don’t believe an iRule has access to an assigned node “name”. You could potentially do a reverse DNS lookup of the server to get its host name, but the simplest option given that you only have 4 app servers, is to create a string-based data group. Example:

Data group “server_dg”

10.10.10.1 := server1

10.10.10.2 := server2

10.10.10.3 := server3

10.10.10.4 := server4

And an iRule something like this:

when HTTP_RESPONSE {
     HTTP::header insert SERVER_ADDRESS [class lookup [IP::server_addr] equals server_dg]
}