Forum Discussion
Kevin_Stewart
Apr 01, 2014Employee
It could be that you're trying to evaluate/insert/replace headers in the same context as a redirect. It may make more sense to combine the iRule cohesively:
when HTTP_REQUEST {
'root domain redirect'
if { [HTTP::host] == "mydomain.com" } {
HTTP::respond 301 Location http://www.mydomain.com[HTTP::uri]
} elseif { [class match [string tolower [HTTP::uri]] equals REDIRECTS_301_SCO ] } {
HTTP::respond 301 Location [class lookup [string tolower [HTTP::uri]] REDIRECTS_301_SCO ]
} else {
if { [HTTP::header exists True-Client-IP] } {
HTTP::header replace X-Forwarded-For [HTTP::header True-Client-IP]
} else {
HTTP::header replace X-Forwarded-For [IP::client_addr]
}
}
}
What F5 version is this? I'm not 100% sure of the second iRule as the HTTP::request command, at least not on a v10 or v11 system, would return a value like "http://asia.mydomain.com/taiwan". Are you certain this iRule is actually working?