Forum Discussion

eric_wu_55610's avatar
eric_wu_55610
Icon for Nimbostratus rankNimbostratus
Aug 04, 2009

URL deny

Hi all,

 

 

Anybody know how to deny URL in iRules ??

 

For example :

 

I want to deny "tw.yahoo.com" this url

 

how can I do write in iRule

 

 

Thank you ~
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi,

    What kind of virtual server do you want to use this for? Is it for a standard L7 "inbound" load balancing VS or an outbound proxy.

    If you want to drop, send a TCP reset or send an HTTP response when a client makes a request to a specific host and or URI for an inbound request, you can use an iRule like this:

     
     when HTTP_REQUEST { 
      
         Check requested host header value 
        if {[string tolower [HTTP::host]] contains "tw.yahoo.com"}{ 
      
            Drop the connection 
           drop 
      
            Reset the connection 
           reject 
      
            Send a 403 response 
           HTTP::respond 403 Content {Not allowed} 
        } 
     } 
     

    If you want to check the URI, you can use HTTP::uri to get the value.

    Aaron