Forum Discussion
Tom_89796
Jun 14, 2012Nimbostratus
Route Domain and IP::Client_addr
Running 10.2.3 LTM with multiple route domains for DR. For one of the Virtual IP's we run the following iRule to capture the requesting IP address and append it to the URI. Problem is the IP::clien...
hooleylist
Jun 14, 2012Cirrostratus
Hi Tom,
You can use getfield to parse the IP address from an IP%rd value:
https://devcentral.f5.com/wiki/iRules.getfield.ashx
set ip [getfield [IP::client_addr] % 1]
Here's an optimized version of your code:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"*login.aspx" -
"*login2.aspx" -
"*accgateway.aspx" {
HTTP::uri "[HTTP::uri]?IPAddress=[getfield [IP::client_addr] % 1]"
}
"*login.aspx\?*" -
"*login2.aspx\?*" -
"*accgateway\?*" {
HTTP::uri "[HTTP::uri]&IPAddress=[getfield [IP::client_addr] % 1]"
}
}
}
Aaron
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects