Forum Discussion
Combine Client accepted and http_request.
when HTTP_REQUEST {
if { [HTTP::host] == "my fqdn" } { HTTP::redirect "https://myfqdn/irj/portal/" pool pool_t_portal }
if { [HTTP::uri] equals "/" or [HTTP::uri] equals "/index.html" or [HTTP::uri] equals "/webdynpro/welcome/Welcome.jsp" } { HTTP::redirect "https://[HTTP::host]/irj/portal/" } if { [HTTP::uri] starts_with "/~" and [HTTP::uri] ends_with "index.html"} { HTTP::redirect "https://[HTTP::host]/irj/portal/" } if { [HTTP::uri] starts_with "/uddiclient" or [HTTP::uri] equals "/uddiclient/process"} { HTTP::redirect "https://[HTTP::host]/irj/portal/" } if { [HTTP::uri] equals "/nwa" } { HTTP::redirect "https://[HTTP::host]/irj/portal/" }
}
when CLIENT_ACCEPTED { if {[IP::addr [IP::client_addr] equals "src.src.src.src"]}{ pool "pool_q_portal" member dst.dst.dst.dst}
}
- Vitaliy_SavransNacreous
In you irule client_accepted must be before http_request because. Client_accepted event (for TCP connections) happens when the three-way handshake successfully completes and http_request follows after it.
- Anand_128528NimbostratusHi Savranskiy I did that earlier and none of the connections were successful so I split http_request and client_accepted into two different irules. So now my query is which comes first If I intend to add both irules. So your answer is put client_accepted first. Let me try this today.
- Vitaliy_SavransNacreous
Here you can find irule references.
- nitassEmployee
i think you may have to disable HTTP_REQUEST event or skip HTTP_REQUEST event if traffic matches condition in CLIENT_ACCEPTED event.
iRules: Disabling Event Processing by Deb Allen
- Anand_128528Nimbostratus
We have 70K users and I want to filter one of the user to land in one nominated pool member rest of users can be assigned by RoundRobin. In such cases what would be the best rule ?
- Kevin_StewartEmployee
Two things:
-
The order of the events in the iRule is not important. The compiler will reorganize and optimize the code as required.
-
Because IP data is available to all events after TCP, you can skip the CLIENT_ACCEPTED event altogether and perform your IP::client_addr check directly inside the HTTP_REQUEST event. You'll obviously need to reorganize your conditional logic to accommodate, but it should ultimately make you iRule simpler.
-
- Anand_128528Nimbostratus
Hello Kevin
Then can I do it as below , Sorry I am new to F5. when HTTP_REQUEST {
if { [IP::addr [IP::client_addr] equals src.src.src.src] } { pool my_pool member dst.dst.dst.dst }
if { [HTTP::host] == "fqdn" } { HTTP::redirect "https://fqdn/irj/portal/" pool pool_t_portal }
if { [HTTP::uri] equals "/" or [HTTP::uri] equals "/index.html" or [HTTP::uri] equals "/webdynpro/welcome/Welcome.jsp" } { HTTP::redirect "https://[HTTP::host]/irj/portal/" } if { [HTTP::uri] starts_with "/~" and [HTTP::uri] ends_with "index.html"} { HTTP::redirect "https://[HTTP::host]/irj/portal/" } if { [HTTP::uri] starts_with "/uddiclient" or [HTTP::uri] equals "/uddiclient/process"} { HTTP::redirect "https://[HTTP::host]/irj/portal/" } if { [HTTP::uri] equals "/nwa" } { HTTP::redirect "https://[HTTP::host]/irj/portal/" }
}
- Kevin_StewartEmployee
Try this:
when HTTP_REQUEST { if { [IP::addr [IP::client_addr] equals src.src.src.src] } { pool my_pool member dst.dst.dst.dst } elseif { [string tolower [HTTP::host]] == "fqdn" } { HTTP::redirect "https://fqdn/irj/portal/" pool pool_t_portal } elseif { ( [HTTP::uri] equals "/" ) or ( [string tolower [HTTP::uri]] equals "/index.html" ) or ( [string tolower [HTTP::uri]] equals "/webdynpro/welcome/welcome.jsp" ) } { HTTP::redirect "https://[HTTP::host]/irj/portal/" } elseif { ( [HTTP::uri] starts_with "/~" ) and ( [string tolower [HTTP::uri]] ends_with "index.html" ) } { HTTP::redirect "https://[HTTP::host]/irj/portal/" } elseif { ( [string tolower [HTTP::uri]] starts_with "/uddiclient" ) or ( [string tolower [HTTP::uri]] equals "/uddiclient/process" ) } { HTTP::redirect "https://[HTTP::host]/irj/portal/" } elseif { [string tolower [HTTP::uri]] equals "/nwa" } { HTTP::redirect "https://[HTTP::host]/irj/portal/" } }
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