Forum Discussion
MDPF5_152674
Altostratus
Apr 07, 2016iRule replace HTTP Host header for virtual Host
Hi DevCentral community.
I would like to create an iRule that replaces the HTTP Host header in order to select a virtual host.
(watch out there is APM in place)
Client request:
Ho...
william_gonzalez
Altostratus
Apr 07, 2016Try this, it works for me:
Create a Datagroup partnering Ip + name (SERVER HOST HEADER) from servers you want to load balance.
After create this, copy this iRule and change "name_datagroup" you have previously created.
when HTTP_REQUEST_SEND {
clientside {
set host_header_value [class match -value [IP::server_addr] equals **name_datagroup**]
Check if the lookup returned a value
if {$host_header_value ne ""}{
Replace the host header value
HTTP::header replace Host $host_header_value
}
}
}
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