Forum Discussion
2funky_105078
Apr 09, 2014Cirrus
data group iRule
Hello iExperts,
I just wanted to double check with you the following irule where i want to double check that the client IP is in a determinate data group range of IPs (ecmvpn_ip_dg) and if so, retu...
- Apr 09, 2014
Hi you don't need to use static variables - just use a TCP connection scoped variable set in CLIENT_ACCEPTED. Not too sure what you want from the switch ...anyway updated slightly
when CLIENT_ACCEPTED { set ecmvpn_flag 0 if { [class match [IP::client_addr] equals ecmvpn_ip_dg] } { set ecmvpn_flag 1 } } when HTTP_REQUEST { if {$ecmvpn_flag}{ You need an FQDN here so I've added ".com.au" HTTP::redirect http://ecmvpn.com.au[HTTP::uri] return } switch -glob [string tolower [HTTP::host]] { "ecm.*" { if {[string tolower [HTTP::uri]] starts_with "/application"} { HTTP::header insert USER-IP [IP::remote_addr] You could just use an HTTP persistence profile attached to the virtual for this persist cookie insert pool pl_DCTM_ECM_APPLICATION return } } default { return } } }
IheartF5_45022
Apr 09, 2014Nacreous
Hi you don't need to use static variables - just use a TCP connection scoped variable set in CLIENT_ACCEPTED. Not too sure what you want from the switch ...anyway updated slightly
when CLIENT_ACCEPTED {
set ecmvpn_flag 0
if { [class match [IP::client_addr] equals ecmvpn_ip_dg] } {
set ecmvpn_flag 1
}
}
when HTTP_REQUEST {
if {$ecmvpn_flag}{
You need an FQDN here so I've added ".com.au"
HTTP::redirect http://ecmvpn.com.au[HTTP::uri]
return
}
switch -glob [string tolower [HTTP::host]] {
"ecm.*"
{
if {[string tolower [HTTP::uri]] starts_with "/application"} {
HTTP::header insert USER-IP [IP::remote_addr]
You could just use an HTTP persistence profile attached to the virtual for this
persist cookie insert
pool pl_DCTM_ECM_APPLICATION
return
}
}
default { return }
}
}
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