Contribute Open Script

[BRCD_OS_106] Reset on Content Match

by Yasir_Liaqatullah on ‎01-19-2012 02:36 PM (240 Views)

Area:

Content Inspection

Traffic:

HTTP

Description:

            This script analyzes incoming requests and depending on the URL, sends a reset.

Performance Estimate

           

            Contact us for our detailed reporting

               or

            Report your own performance estimate

Required Backend configuration

            No special configuration is required

Events and API Used

Events

API

HTTP_REQUEST

OS_HTTP_REQUEST::url

OS_SLB::reset

Script source code

# Purpose: Inspect the incoming URL and send a reset if it matches

# a particular pattern.

#

use OS_SLB;

use OS_HTTP_REQUEST;

#############################################

#

# HTTP REQUEST EVENT

#

#############################################

sub HTTP_REQUEST {

       # Get the URL from the request

       my $client_url = OS_HTTP_REQUEST::url;

       # print "\n\nClient url is - $client_url\n\n";

       # Group selection based on the HOST in the request

       if ($client_url =~ m/mysite\/forbidden/) {

              # print "Client accessing forbidden URL, sending reset";

              OS_SLB::reset_client();

       } else {

              # print "forward to server group 10";

              OS_SLB::forward(10);

       }

}