Forum Discussion
darrenclegg_199
Nimbostratus
Sep 09, 2011Access restriction to certain URLs
I have a simple iRule to only allow certain URLs access(see below)
when HTTP_REQUEST
{ if { not ([string tolower [HTTP::host]] eq "www.domain.com") }{
drop
HTTP::respond 200 content \ "Wrong URL entered Access not allowed" "Content-Type" "text/html" } }
I want to allow other URLs within the same iRule e.g www.domain1.com, www.domain2.com.
Can anyone help?
- Michael_Yates
Nimbostratus
The iRule that you have created is a literal compare, so the other domains should not be blocked by this iRule. - Eddy_20831
Nimbostratus
Michael,
- Eddy_20831
Nimbostratus
want to delete this post.
- Eddy_20831
Nimbostratus
Another redundant post to delete.
- SSHSSH_97332
Nimbostratus
You Can create a data group that contains all of the needed URIs then use the data group inside the IRule - nitass
Employee
e.g.[root@ve10:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve10:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if { [class match -- [string tolower [HTTP::uri]] starts_with redirect_class] } { HTTP::redirect "http://[getfield [HTTP::host] ":" 1]/" } } } [root@ve10:Active] config b class redirect_class list class redirect_class { { "/123" "/abc" "/xyz" } } [root@ve10:Active] config curl -I http://172.28.19.79/abc/something HTTP/1.0 302 Found Location: http://172.28.19.79/ Server: BigIP Connection: Keep-Alive Content-Length: 0
- Eddy_20831
Nimbostratus
thanks all - Eddy_20831
Nimbostratus
worked beautifully
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