11-Apr-2022 06:40 - edited 11-Apr-2022 06:41
Hi experts ,
I need help to understand the below irule ,
Why we have 2 condition for the same url , 1 to replace the host and then to redirect to the pool ?
VIP url ; https://csk-net-corp.aci.network/test/network/lb/corp/v1
when HTTP_REQUEST {
if { ([string tolower [HTTP::path]] starts_with "/X509/services" )} then
{
## rien
} else
{
if {([string tolower [HTTP::host]] equals "csk-net-corp.aci.network")}{
HTTP::header replace Host "csk-net-bw.aci.network"
if { [HTTP::path] starts_with "/test/network" } { pool P_CSK_NET_5001
}
}
}
12-Apr-2022 00:35
To update the Host header value without redirecting the client to the new Host value, you can use HTTP::header replace Host “csk-net-bw.aci.network”. This update will only affect the request to the pool member. The client will not see the update unless the web application uses the requested host header value to generate response headers and/or content.
if {([string tolower [HTTP::host]] equals "csk-net-corp.aci.network")}{
HTTP::header replace Host "csk-net-bw.aci.network"
}
In 2nd request, traffic are served by different group of pool member if condition matches. URL will be remain same csk-net-corp.aci.network
if { [HTTP::path] starts_with "/test/network" } { pool P_CSK_NET_5001
}
12-Apr-2022 10:48
Hi @Samir , thanks for your reply ..
I have few doubts ,
1) In my case both the condition or request are there in the same irule.So it will replace the host header and also it will send the request to the specified pool - P-CSK_NET_5001 right ?
2)In which scenrio we would require to change the host haeder , whar are we going to achive with that ?
13-Apr-2022 02:06
Hi
if {([string tolower [HTTP::host]] equals "csk-net-corp.aci.network")}{
HTTP::header replace Host "csk-net-bw.aci.network"
>> In condition above some server require specific host name, We have to rewrite host name before send to servers
if { [HTTP::path] starts_with "/test/network" } { pool P_CSK_NET_5001
>> in condition above F5 check path that start with "/test/network" and forward to pool P_CSK_NET_5001
I hope this information will help you