Forum Discussion
Tom_89796
Nimbostratus
Jun 14, 2012Route 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::client_addr is returned with the appended %1 as this route domain is not the default. That being the case the appending IP::client_addr is including the route domain which is breaking the application.
Is there a way to drop to trailing %rd from the IP Address?
when HTTP_REQUEST {
set client [IP::client_addr]
set request [HTTP::uri]
if {$request contains "login.aspx" and $request contains "?"}
{HTTP::uri "[HTTP::uri]&IPAddress=[IP::client_addr]"}
elseif {$request contains "login.aspx"}
{HTTP::uri "[HTTP::uri]?IPAddress=[IP::client_addr]"}
elseif {$request contains "ACCGateway.aspx" and $request contains "?"}
{HTTP::uri "[HTTP::uri]&IPAddress=[IP::client_addr]"}
elseif {$request contains "login2.aspx"}
{HTTP::uri "[HTTP::uri]?IPAddress=[IP::client_addr]"}
elseif {$request contains "login2.aspx" and $request contains "?"}
{HTTP::uri "[HTTP::uri]&IPAddress=[IP::client_addr]"}
}when HTTP_REQUEST {
set client [IP::client_addr]
set request [HTTP::uri]
if {$request contains "login.aspx" and $request contains "?"}
{HTTP::uri "[HTTP::uri]&IPAddress=[IP::client_addr]"}
elseif {$request contains "login.aspx"}
{HTTP::uri "[HTTP::uri]?IPAddress=[IP::client_addr]"}
elseif {$request contains "ACCGateway.aspx" and $request contains "?"}
{HTTP::uri "[HTTP::uri]&IPAddress=[IP::client_addr]"}
elseif {$request contains "login2.aspx"}
{HTTP::uri "[HTTP::uri]?IPAddress=[IP::client_addr]"}
elseif {$request contains "login2.aspx" and $request contains "?"}
{HTTP::uri "[HTTP::uri]&IPAddress=[IP::client_addr]"}
}
2 Replies
- hoolio
Cirrostratus
Hi Tom,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]" } } }
- Tom_89796
Nimbostratus
Perfect! Thanks for the assist hoolio.
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