Forum Discussion
How to redirect based on same URL
Hi evreyone.
I have two VS and two Pools as follows
==================================
VS_1 (10.10.10.20:80)
P1 (20.20.20.20:80)
VS_2 (10.10.10.20:8080)
P2 (20.20.20.20:8080)
was.abc.com = 10.10.10.20
====================================
If I type "was.abc.com" in the browser, I want to redirect traffic to P2
If I type "was.abc.com/sso/unity_login.jsp" in the browser, I want to redirect traffic to P1
What should I do?
Thank you,
HoWoon
6 Replies
- nitass
Employee
is this applicable?
sol9800: Using an iRule to load balance HTTP requests to multiple pools
http://support.f5.com/kb/en-us/solutions/public/9000/800/sol9800.html - Mia_27938
Nimbostratus
Thank you, Nitass
I applied the following two rules to VS1 without OneConnect, but I failed..
when CLIENT_ACCEPTED {
set def_pool [LB::server pool]
}
when HTTP_REQUEST {
if {[string tolower [HTTP::uri]] starts_with "/sso/unity_login.jsp"} {
pool $def_pool
}
elseif {
pool P2
}
}
when CLIENT_ACCEPTED {
set def_pool [LB::server pool]
}
when HTTP_REQUEST {
if {[string tolower [HTTP::uri]] starts_with "was.abc.com"} {
pool P2
}
else {
pool $def_pool
}
}
Why can not??
Thank you,
Ho - nitass
Employee
but I failed..what does it mean (e.g. tcl error, packet drop, sending to wrong pool, etc)?? - Mia_27938
Nimbostratus
Thx for reply
Sorry for my ambiguous questions!!
TCL error..
Hmm.
I thinking about...
I would like to change "was.abc.com" in the request to
"was.abc.com/sso/unity_login.jsp".was.abc.com typed in the browser ------------->> changing to
was.abc.com/sso/unity_login.jsp by LTM ----------------->> pool members.Thank you
Ho.
- The_Bhattman
Nimbostratus
Hi Ho,
Sounds like a simple redirect
There is a pretty simple way to do conditional redirects, which is using HTTP CLASS profile. There is a forum topic on it
https://devcentral.f5.com/community/group/aft/2160949/asg/5
Another is using the iRule
Here is an example of what it could look likewhen HTTP_REQUEST { if { ([HTTP::host] eq "was.abc.com") and ([string tolower [HTTP::uri]] ends_with "/") } { HTTP::redirect http://[HTTP::host]/sso/unity_login.jsp } }
I prefer the easy button so I usually go with HTTP CLASS Profiles for this kind of stuff.
I hope this helps,
Bhattman - Mia_27938
Nimbostratus
Hi Bhattman,
Thank you for your reply.
I have solved by using the follwoing rule.
when HTTP_REQUEST {
log local0. "in HTTP_REQUEST"
if { [HTTP::uri] starts_with "/sso" } {
pool my_HTTP_was_pool
}
elseif {[HTTP::host] eq "was.kornu.ac.kr"}{
pool my_8080_was_pool
} else {
pool my_HTTP_was_pool
}
}
But, your rule looks very better.
Thank you.
Ho.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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