Forum Discussion
F5 redirect and change URL
I was reading thru the previously asked questions related to our scenario, and have tried but fails.
In Our environment, we have an URL http://1n2m.n2m.com/eds/getInfo with method POST. The URL needs to route to another pool with changing HOST and URI. The new URL will be http://2n2m.n2m.com/InfoDetails
I have tried as below, but did not work
if { ( [HTTP::host] equals "1n2m.n2m.com:443") || ([HTTP::host] equals "1n2m.n2m.com") }
{
Check URI with wildcard matching
if { [ HTTP::path ] contains "/eds/" }
{
node 10.17.69.11
HTTP::header replace Host "https://2n2m.n2m.com"
HTTP::uri "/InfoDetails/v1/"
HTTP::redirect "https://2n2m.n2m.com/InfoDetails/v1/"
pool mule_test_pool_01
}
else
{
pool legacy_pool_01
}
}
else
{
log local0.info "Invalid [HTTP::host] [HTTP::path]"
reject
}
Problem we have is, as i have added redirect, the URL switch is noticed.
We do not want the URL to change for the enduser. If i do not add the redirect line, it does not work.
Any suggestion on how to correct it?
- Anesh
Cirrostratus
Try the below:
HTTP::header replace "Host" "2n2m.n2m.com" HTTP::uri "/InfoDetails/v1/"
- omprakashnm_321
Nimbostratus
Is there a way to debug the pool route. When redirect is issued, we can see traffic hitting the pool. But changing "host" in the header does not help.
Any idea or checkpoints?
- Ilian_Ivanov
Nimbostratus
I think that the easiest way is to use Rewrite profile instead of iRule.
Use that link for more information -> https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm-implementations-11-4-0/21.html
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