For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Shay_Ben-David1's avatar
Shay_Ben-David1
Icon for Nimbostratus rankNimbostratus
Mar 25, 2008

block 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

  • 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" } {

     

  • 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
  • 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
  • You sure can

    Here is an example

    
    when HTTP_REQUEST {
    if { ([HTTP::uri] equals "/") or ([HTTP::uri] equals "/something") } {
    HTTP::redirect "http://site.mysite.com "
    }
    else {
    pool newpool
    } 
    }

    /CB