Forum Discussion
CHANGE THE HOST NAME IF THE CONNECT IS A POOL MEMBER
So if I understand you correctly, you're evaluating the URI to send to a pool, and you do this in the HTTP_REQUEST event. The LB events are triggered next and a pool member is selected. By the time you get to the HTTP_REQUEST_RELEASE event, you've already chosen a pool, selected a pool member, and can now alter the Host header going to that server based on the provided information.
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/home" } {
pool home_pool
} else {
pool other-pool
}
}
when HTTP_REQUEST_RELEASE {
switch [LB::server addr] {
"10.70.0.1" {
HTTP::header replace Host "server1:14002"
}
"10.70.0.2" {
HTTP::header replace Host "server2:14002"
}
}
}
If you also need to change the URI path, that can be done in either HTTP event with the HTTP::uri command. The ":14002" in the above is part of the Host header. Actual ports are defined in the individual pools and the VIP's port translation setting.
Recent Discussions
Related Content
* 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