Forum Discussion
player_72606
Nimbostratus
Jul 19, 2009uri by source ip
Hi all,
newbie here :-)
i need help writing iRule to filter uri by source ip :
for uri /web/admin=1 - source ip 1.1.1.1
for uri /web/admin=0 - all others
...
hoolio
Cirrostratus
Jul 20, 2009Hi,
Do you want to only allow requests to /web/admin.aspx with a parameter login-1 to a single IP address? What do you want to do if a request is made for this path with login=1 from a disallowed client IP address?
Here is an example to get you started:
when HTTP_REQUEST {
Check requested path
if {[string tolower [URI::decode [HTTP::path]]] eq "/web/admin.aspx"}{
Check login parameter value
if {[URI::query [HTTP::uri] "login"] eq "1"}{
Request to restricted resource. Check if client IP is not 1.1.1.1
if {not ([IP::addr [IP::client_addr] equals 1.1.1.1])}{
Take some action to prevent request?
Rewrite login=1 to login=2
HTTP::uri [string map {login=1 login=2} [HTTP::uri]]
Redirect client to rewritten URI?
HTTP::redirect [string map {login=1 login=2} [HTTP::uri]]
}
}
}
}
Aaron
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
