Contribute Open Script

[BRCD_OS_113] URL Rewrite

by Yasir_Liaqatullah on ‎01-20-2012 02:38 PM (264 Views)

Area

Content Rewrite

Traffic

HTTP

Description

            This script analyzes the incoming request and changes the URL before forwarding the request to a server.

Performance Estimate

           

            Contact us for our detailed reporting

               or

            Report your own performance estimate

Required Backend configuration

            No additional configuration is required on ADX

Events and API Used

Events

API

HTTP_REQUEST

OS_HTTP_REQUEST::url

OS_SLB::forward

Script source code

#Purpose: Rewrite URL

use OS_SLB;

use OS_HTTP_REQUEST;

sub HTTP_REQUEST () {

   #print "HTTP Request event is triggered\n";

   my $current_url = OS_HTTP_REQUEST::url;

   #print "URL in received HTTP Request - $current_url\n";

   # Change the URL

   my $new_url = "/newdir/newfile.html";

   OS_HTTP_REQUEST::url("$new_url");

   OS_SLB::forward("30");