Forum Discussion
irulse for url limit
Hi I have a host "http://ocean.jiedaibao.com.cn" load balance through F5 LTM, but I do not want this URL "http://ocean.jiedaibao.com.cn/admin/system/login/?redirect=/admin" through F5 LTM . The url contain "login" need to be limited ; Who can give me a irulse to do this ?
Thanks!!
6 Replies
- PeteWhite
Employee
when HTTP_REQUEST { if {[string tolower [HTTP::query]] contains "redirect=/admin"} { HTTP::respond 404 } } - Theo_12742
Cirrus
If by limited you mean rejected:
when HTTP_REQUEST { if { [HTTP::uri] contains "login" } { HTTP::close } }- yuanqiang_22112
Nimbostratus
@ theo, thank you for your answer ,I will try it for this
- Josiah_39459Historic F5 Account
If you want one uri to come to the F5 and another uri to bypass the F5, that's impossible, since a DNS server only gets a host name name and the uri is at a different (higher) layer. The best you could do is have the F5 send the traffic from one uri to one pool, and another uri to a different pool, but it still has to traverse the F5.
If your meaning is different, please describe more clearly.
- PeteWhite
Employee
Updated to include checking of source IP address:
when RULE_INIT { set static::admin_datagroup "admin_datagroup" } when HTTP_REQUEST { if {[string tolower [HTTP::query]] contains "redirect=/admin"} { if { ! [class match [IP::client_addr] equals $static::admin_datagroup] } { HTTP::respond 404 } } } - Stanislas_Piro2
Cumulonimbus
You can replace condition
[string tolower [HTTP::query]] contains "redirect=/admin"with (this will search
parameter in query string and filter on the parameter value)redirect[string to lower [URI::query [HTTP::uri] redirect]] starts_with "/admin"or
[string to lower [URI::query [HTTP::uri] redirect]] equals "/admin"One other recommendation is to filter on HTTP::path instead of HTTP::uri if login string is in path part of the URI.
The final iRule can be:
when RULE_INIT { set static::admin_datagroup "admin_datagroup" } when HTTP_REQUEST { if {([HTTP::path] ends_with "/login/") && ([string to lower [URI::query [HTTP::uri] redirect]] starts_with "/admin")&& ! [class match [IP::client_addr] equals $static::admin_datagroup]} { HTTP::respond 404 } }
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