Forum Discussion
muzammil_88686
Nimbostratus
Nov 28, 2012iRule - Source Address and "X-Forwarded For"
Currently we are using the below iRule which is chekcing the "X-Forwarded-For" in HTTP header and 10.0.0.0/16 source address
===
when HTTP_REQUEST {
if {([HTTP::header exists "X-F...
What_Lies_Bene1
Cirrostratus
Nov 29, 2012This should do it. It would be better to use ifs instead of switch but leaving it as is makes it more flexible if you want to expand the address ranges;
when HTTP_REQUEST {
if { ([HTTP::header exists "X-Forwarded-For"]) and ([string tolower [HTTP::uri]] equals "/wf") } {
switch -glob [HTTP::header values "X-Forwarded-For"] {
"10.3.*" {
HTTP::redirect "http://www.test.com/WF?sr=new"
return
}
}
}
elseif { ([HTTP::header exists "X-Forwarded-For"]) and ([string tolower [HTTP::uri]] contains "/wf/hp.me") } {
switch -glob [HTTP::header values "X-Forwarded-For"] {
"10.0*" {
HTTP::redirect "http://www.test.com/WF/H.me"
return
}
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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