Forum Discussion
iRule to Redirect url to anther url
Hi Dears,
requesting your kind support for below scenario.
- I have two VS with the same IP but each one in different ports (1st one in port 80, 2nd one in port 8080)
- I have two pools in ports 80 & 8080 associated to the above VS.
- when the users type the full URL everything working perfectly.
the issue is that:
I have two URLs opening the same application 1st one is http://kmt and the full URL is http://kmt/livetest/livetest.exe?func=llworkspace.
so I need to the users only to write first url http://kmt, then they can redirected to the full url.
I tried below iRule but not opening .
when HTTP_REQUEST {
if { [HTTP::host] eq "kmt" } {
HTTP::redirect "http://kmt/livetest/livetest.exe?func=llworkspace"
}
}
may it's very simple but am new in F5 field.
thanks in advance and appreciate your urgent support.
- iaine
Nacreous
Hi
Add in some URI logic otherwise you're going to get a redirect loop. So something like...
when HTTP_REQUEST { if { ([HTTP::host] eq "kmt") && ([HTTP::uri] eq "/")} { HTTP::redirect "http://kmt/livetest/livetest.exe?func=llworkspace" } }
- Osama
Nimbostratus
Hi iaine,
thanks for your quick support, I applied for the VS but still not redirected.
I wanna ask here, this iRule should be applied in which VS as I have two VS one in port 80 and second in port 8080
- Osama
Nimbostratus
Hi,
this the correct iRule, it's working fine now.
when HTTP_REQUEST {
if { [HTTP::host] contains "kmt" and [HTTP::path] eq "/" } {
HTTP::redirect "http://kmt/livetest/livetest.exe?func=llworkspace""
}
}
- iaine
Nacreous
well the url that you posted doesn't have any indication of port in it (http://kmt/livetest/livetest.exe?func=llworkspace) so I would assume that this traffic is on your port 80 vip.
What traffic goes to your port 8080 vip? Does the URL change to something like http://kmt:8080 ?
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