Forum Discussion
Need Irule to replace http host based on pool member
Team,
Need an Irule to replace http host based on pool member when sending request.
Users will target abc.com VIP in f5 and F5 has got xyz.com and def.com - After F5 picks pool member based on LB method F5 need to replace the http host as xyz.com or def.com before sending to pool members.
Can you please help me with Irule .
- Chandru_01Nimbostratus
when CLIENT_ACCEPTED {
if { [IP::addr [LB::server addr] equals $xyz] }{
set server xyz
}
if { [IP::addr [LB::server addr] equals $def] }{
set server def
}
}
when HTTP_REQUEST {
STREAM::disable
HTTP::header remove "Accept-Encoding"
if {$server == xyz} {
HTTP::header replace "Host" "xyz.com"
}
if {$server == def} {
HTTP::header replace "Host" "def.com"
}
}
when HTTP_RESPONSE {
if { [HTTP::header Location] contains "xyz.com" } { HTTP::header replace Location [string map {"xyz.com" "abc.com"} [HTTP::header Location]] }
if { [HTTP::header Location] contains "def.com" } { HTTP::header replace Location [string map {"def.com" "abc.com"} [HTTP::header Location]] }
if {[HTTP::header value Content-Type] contains "text"}{
STREAM::expression {@xyz.com@abc.com@@def.com@abc.com@}
STREAM::enable
}
}
- senthilNimbostratus
Thank you..Will it still work if backend is https .
Thanks
Senthil
- Chandru_01Nimbostratus
If you have SSL bridging configured, it will work
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