Forum Discussion
Domai
Altostratus
Sep 14, 2016iRule check data data group assist
Hello I need help with an iRule if possible. I am trying to accomplish 2 things. 1. Redirect if the url is abc.com to abc.com/login.jsp 2. Check if the uri is part of data group and allow.
So far I have
1 when HTTP_REQUEST {
if { [HTTP::uri] equals "/" } {
HTTP::redirect "https://abc.com/login.jsp"
}
}
2. when HTTP_REQUEST {
if { [class match [string tolower [HTTP::path]] starts_with allow_uri_list] } {
pool allow_pool_80
}
else {
Log the request for testing from client
log local0. "rejected request for [HTTP::path] from [IP::client_addr]"
HTTP::respond 200 content "Please check the URL and try again."
reject
}
}`text`
How do I club both of the ie I need to check for / and redirect and also check the uri is the allow_uri_list? Should I create 2 diff iRules and apply them to same vip? I know that is messy. Any other way is possible?
1 Reply
- Vijay_E
Cirrus
Assuming the iRule is intended ONLY for abc.com domain:
when HTTP_REQUEST { if { [HTTP::host] eq "abc.com" } { if { [HTTP::uri] equals "/" } { HTTP::redirect "https://abc.com/login.jsp" } elseif { [class match [string tolower [HTTP::uri]] starts_with allow_uri_list] } { pool allow_pool_80 } else { Log the request for testing from client log local0. "rejected request for [HTTP::path] from [IP::client_addr]" HTTP::respond 200 content "Please check the URL and try again." } } }
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
