Forum Discussion
Add new iRule with same VIP
- Mar 20, 2017
I believe host name is not same in both iRule. Find the consolidated irule based on condition.
when HTTP_REQUEST { if { (([string tolower [HTTP::host]] equals "xxxxxx") and ([string tolower [HTTP::uri]] starts_with "/servicecenter")) } { pool XXXXXX_8443 } elseif { (([string tolower [HTTP::host]] equals "xxxxxxxx") and ([string tolower [HTTP::uri]] starts_with "/users")) } { pool xxxxxxx_8444 } }
Use switch option if the host name is common in both irule.
I believe host name is not same in both iRule. Find the consolidated irule based on condition.
when HTTP_REQUEST
{
if { (([string tolower [HTTP::host]] equals "xxxxxx") and ([string tolower [HTTP::uri]] starts_with "/servicecenter")) }
{ pool XXXXXX_8443 }
elseif { (([string tolower [HTTP::host]] equals "xxxxxxxx") and ([string tolower [HTTP::uri]] starts_with "/users")) }
{ pool xxxxxxx_8444 }
}
Use switch option if the host name is common in both irule.
- Senthil_7991Mar 20, 2017Nimbostratus
Thanks
In this case host is same "abc.com", May I know how to us switch option?.
when HTTP_REQUEST { if { (([string tolower [HTTP::host]] equals "abc.com") and ([string tolower [HTTP::uri]] starts_with "/servicecenter")) } { pool XXXXXX_8443 } elseif { (([string tolower [HTTP::host]] equals "abc.com") and ([string tolower [HTTP::uri]] starts_with "/users")) } { pool xxxxxxx_8444 } }
- Samir_Jha_52506Mar 20, 2017Noctilucent
write irule like this.
when HTTP_REQUEST { if { ([string tolower [HTTP::host]] equals "abc.com") } { set uri [string tolower [HTTP::uri]] switch -glob $uri { "/servicecenter*" { pool XXXXXX_8443 } "/users/" { pool xxxxxxx_8444 } }
} }
- Samir_Jha_52506Mar 20, 2017Noctilucent
write irule like this.
when HTTP_REQUEST { if { ([string tolower [HTTP::host]] equals "abc.com") } { set uri [string tolower [HTTP::uri]] switch -glob $uri { "/servicecenter*" { pool XXXXXX_8443 } "/users/" { pool xxxxxxx_8444 } }
} }
- Senthil_7991Mar 21, 2017Nimbostratus
Thanks for your support
It seems to be working fine as expected :)
- Senthil_7991Mar 24, 2017Nimbostratus
Hi
We would like to know about difference of "/servicecenter*" and "/users/".
There is after servicecenter got * mark and after uers got /
Please help me to clarify the reasons.
Thank you
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