Forum Discussion
Gurdip_Sira_172
Nimbostratus
Sep 04, 2016Redirect some users if they hit a certain uri
Hi,
I need to redirect certain users (client IP's) when they land to a certain page behind my virtual page.
Basically the below and also checking if the uri equals a page:
when HTTP_REQUEST {
...
Kai_Wilke
MVP
Sep 06, 2016Hi Gurdip,
unless you're using HTTP/1.0 without keep-alive sessions, then it would be more effective to evaluate the Client IP during the CLIENT_ACCEPTED event (triggered once at the beginning of each TCP session), store the
[class match] results into a $variable and the use the stored results on each single HTTP_REQUEST.
when CLIENT_ACCEPTED {
if { [class match [IP::client_addr] equals my_ip_dg] } {
set is_redirect 1
} else {
set is_redirect 0
}
}
when HTTP_REQUEST {
if { $is_redirect } then {
if { [string tolower [HTTP::path]] equals "/somepath" } then {
HTTP::redirect "http://10.200.200.200"
}
}
}
Note: Feel free to combinate the
and if $is_redirect
conditions. I've splitted them just for demonstration purposes.if HTTP::path
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects