Forum Discussion

ukitsysadmin_95's avatar
ukitsysadmin_95
Icon for Nimbostratus rankNimbostratus
Feb 22, 2013

drop any request that has a '~' in it

Hello all

 

 

Whats the best way to right an irule that will drop any request that has '~' in it and logging the url that person has hit

 

regards

 

jim

 

5 Replies

  • This should cover it;

    
    when HTTP_REQUEST {
     if { string tolower [HTTP::uri] contains “~” } {
       Drop the request and send a TCP RST to the client
       log local0. “Rejected request for [HTTP::host][HTTP::uri]
       reject
      }
     else {
      Stop processing the iRule for this event here
      return
     }
    }
    
  • Correction (was missing some []);

    
    when HTTP_REQUEST {
     if { [string tolower [HTTP::uri]] contains “~” } {
       Log the requested URL for reference
       log local0. “Rejected request for [HTTP::host][HTTP::uri]
       Drop the request and send a TCP RST to the client
       reject
      }
     else {
      Stop processing the iRule for this event here
      return
     }
    }
    
  • Arrgghhh. Missed a " at the end of the log statement;

    
    when HTTP_REQUEST {
     if { [string tolower [HTTP::uri]] contains “~” } {
       Log the requested URL for reference
       log local0. “Rejected request for [HTTP::host][HTTP::uri]”
       Drop the request and send a TCP RST to the client
       reject
      }
     else {
      Stop processing the iRule for this event here
      return
     }
    }
    
  • Hi Steve

     

     

    thanks for that will test this next week

     

     

    have a good weekend

     

     

    Jim