Forum Discussion
F5 LTM - iRule that will replace the host, remove the path and send traffic to the specific pool
Hi,
You can have below iRules on your VS to achieve your requirement.
iRule 1 -
when HTTP_REQUEST {
if { ([HTTP::host] equals "example.com") && ([HTTP::uri] starts_with "/vpc") } {
HTTP::respond 301 Location "https://example2.net"
}
}
iRule 2 - For Pool selection
when HTTP_REQUEST
{
switch [HTTP::host] {
"example2.net" {pool example2_pool}
}
}
You can bind these iRules to your virtual server so it will match for desired requests, rest requests will be forwarded to the default pool.
Hope it helps!
Mayur
Hi. I did not add that 301 also cannot be used. My bad, sorry for that The thing is that we cannot add DNS entry with example2.net. So the user can only connect using example.com and all the redirect to example2.net/ needs to be done on the F5. I hope it's possible. However I'm not sure if there will be an issue after the user will get the response from example2.net. It's complicated :D
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