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
- The_Bhattman
Nimbostratus
when HTTP_REQUEST { if { NOT ( [string tolower [HTTP::host]] equals "www.mysite.com" ) } { log local0. "client: [IP::client_addr], requested [HTTP::host][HTTP::uri]" discard } }
- Shay_Ben-David1
Nimbostratus
does your change will allow www.mysite.com/images/abc.jpg or some other uri ? - Nicolas_Menant
Employee
yes it will allow everything starting with www.mysite.com - The_Bhattman
Nimbostratus
The rule is to allow ONLY host "www.mysite.com" in with any combination of URI. - Shay_Ben-David1
Nimbostratus
lets say i would like to redirect everything that goes to www.mysite.com, and different uri will not be redirected like: www.mysite.com/images/abc.jpg or any other request beside the www.mysite.com, do you have idea how to perform this ? - Nicolas_Menant
Employee
when HTTP_REQUEST { - Nicolas_Menant
Employee
when HTTP_REQUEST { - The_Bhattman
Nimbostratus
Here is another adding a discard into nmenant's codewhen 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 } }
- Shay_Ben-David1
Nimbostratus
im getting error on line1 and 2 ? - Nicolas_Menant
Employee
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 } }
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