Forum Discussion
astokes_6920
Nimbostratus
Nov 11, 2010Rewrite host header to specific pool member
I've done basic host header rewrites rules in the past but I've just received an odd request that's beyond me. I'm scrapping together a solution from multiple posts but haven't got anything to pass y...
suprgroovy_1658
Nimbostratus
Dec 14, 2010I am picking up this project from Andy, and have had to reverse-engineer this irule back into our QA environment (runs the same version of code), and of course, it doesnt work there. I created the data class with the same name and syntax, just with the new IP addresses and string to lookup. the debug logs showthis:
Looked up 10.52.4.67, found: .
I will repost what what i have in the QA environment:
when HTTP_REQUEST_SEND {
Log debug messages to /var/log/ltm? 1=yes, 0=no.
set host_debug 1
Need to force the host header replacement and HTTP:: commands into the clientside context
as the HTTP_REQUEST_SEND event is in the serverside context
clientside {
if {$host_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: New [HTTP::method] request to [HTTP::host][HTTP::uri]"}
Look up the selected server IP in the datagroup to get the host header value
set host_header_value [findclass [LB::server addr] netenghosts " "]
if {$host_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: Looked up [LB::server addr], found: $host_header_value."}
Check if the lookup returned a value
if {$host_header_value ne ""}{
Replace the host header value
HTTP::header replace Host $host_header_value
if {$host_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: Replaced Host header with $host_header_value."}
}
}
}
class netenghosts {
"10.52.4.67 ims.next004pqa.services.qaprod.company.com"
}
I essentially copied and pasted from the production devices, so it doesnt appear that the irule or data class syntax is bad, yet persists in not finding the lookup value.
TIA
-clay
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
