Forum Discussion
tacobell_112236
Nimbostratus
Dec 08, 2010URL access based on IP\LDAP
Im new to F5 ASM so I apologize for my ignorance in advance. Is it possible to create an IRule to allow access to a webpage based on IP adresses and\ or LDAP group?
I see this as an example but not sure how to add multiple IP addresses and I dont want a redirect. Any help is appreciated.
when HTTP_REQUEST { if { ([HTTP::uri] starts_with "/admin") and ([matchclass [IP::remote_addr] equals $$IPAddressDataGroup]) } { HTTP::redirect "https://foo.com/admin/index/index/" } else { HTTP::redirect "https://foo.com/login/index/login/" } }
11 Replies
- hoolio
Cirrostratus
This is what I was thinking of for your second scenario of an IP and multiple URI checks:when CLIENT_ACCEPTED { Look up client IP once per TCP connection if { [matchclass [IP::client_addr] equals IPAddressDataGroup] }{ set matched_ip 1 } else { set matched_ip 0 } } when HTTP_REQUEST { If we had a match on the client IP, check the requested URI with wildcards if {$matched_ip==1}{ switch -glob [HTTP::uri] { "/adstructure*" - "/CiteCode*" - "/jsp/funsite*" { IP and URI check were both true, so redirect client to custom URL HTTP::redirect "https://www.xxx.com/adstructure/xxx/login.jsp/index/index/" Exit this event in this iRule return } } } If we haven't exited this event already, send a default redirect HTTP::redirect "https://www.xxx.com/" }
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
