Forum Discussion
Shay_Ben-David1
Nimbostratus
Mar 25, 2008block access to domain
is there a way to filter access only to the domain root like www.mysite.com, and allow everything else, in order to allow users bookmarks and uri with specific url+uri
my irule is :
when HTTP_REQUEST {
if { ( [string tolower [HTTP::header Host]] equals "www.mysite.com" ) }{
log "client: [IP::client_addr], requested [HTTP::host][HTTP::uri]"
discard
}
}
i want to add the http::uri
thanks
14 Replies
- Shay_Ben-David1
Nimbostratus
i add the ], but it did'nt help then.
message :
line 1: [parse error: missing close-brace] [{
line 2: [command is not valid in the current scope] [if { [string tolower [HTTP::host]] equals "www.mysite.com" } { - Nicolas_Menant
Employee
Yes it it this :when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "www.mysite.com" } { switch -glob [HTTP::uri] { "/images*" - "/admin*" - default { HTTP::redirect "www.newsite.com" } } } else { discard } }
1 } was missing to close the if statement sorry - Shay_Ben-David1
Nimbostratus
thanks for your help, eventually i used this irule:
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" } {
HTTP::redirect "http://site.mysite.com "
}
else {
pool newpool
}
}
my question is, if i can add another equals on the if line and use the "or" command ?
thanks - The_Bhattman
Nimbostratus
You sure can
Here is an examplewhen HTTP_REQUEST { if { ([HTTP::uri] equals "/") or ([HTTP::uri] equals "/something") } { HTTP::redirect "http://site.mysite.com " } else { pool newpool } }
/CB
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
