Hi All,         I have written a mod_perl proxy server which redirects the HTTP 
traffic to a webserver.    I have pasted the snippet below.      In the apache 
worker thread, is enable. In the httpd.conf two <LocationMatch> are configured 
http://ipaddress/path1/http://ipaddress/path2/ After starting the http server 
if i open any URL from the browser, same “TEST_VAR” is being printedfor both 
the URLs. If I call path1 first, then for both the URLs 100 is printed.If I 
call path2 first, then for both the URLs 200 is printed.(that is its taking the 
first called Path, after httpd is started) 
#----------------------------Startup.pl 
--------------------------------------------##startup.pl use lib 
qw(/home/test1/libs); 1; #--------------------------------- 
#---------------------------- 
httpd.conf---------------------------------------------#  # httpd.conf 
PerlRequire /home/test1/startup.pl #http://ipaddress/path1/<LocationMatch 
/path1/>     SetEnvIf Request_URI "/" TEST_VAR=100     SetHandler perl-script   
  PerlResponseHandler Module::Test</LocationMatch> 
#http://ipaddress/path2/<LocationMatch /path2/>     SetEnvIf Request_URI "/" 
TEST_VAR=200     SetHandler perl-script     PerlResponseHandler 
Module::Test</LocationMatch> 
#-------------------------------------------------------------------------------#
  #---------------------------- Test.pm 
---------------------------------------------# # Test.pm package Module::Test; 
use strict; use Apache2::Const qw(:methods :http :common);use Apache2::Log 
();use Apache2::URI ();  my $param = env_variable(); sub handler{    
Apache2::ServerRec::warn($param);   print "Value".$param;   return 
Apache2::Const::OK;}  sub env_variable{       # Configuration loading from a 
file during startup       my $endpointURL = $ENV{'TEST_VAR'};       return 
$endpointURL;} 1; 
#--------------------------------------------------------------------------------
  But I tried with <VirtualHost> option and it is working fine as PerlOptions 
+Parent is present.But since the port numbers are different firefox will now 
allow simulataneous access toboth URL from same webpage.  
#http://ipaddress:8080/path1/<VirtualHost *:8080>    SetEnvIf Request_URI "/" 
TEST_VAR=100    PerlRequire /home/test1/startup.pl     PerlOptions +Parent     
<LocationMatch /path2/>          SetHandler perl-script          
PerlResponseHandler Module::Test     </LocationMatch></VirtualHost>  
#http://ipaddress:8085/path2/<VirtualHost *:8085>    SetEnvIf Request_URI "/" 
TEST_VAR=200    PerlRequire /home/test1/startup.pl     PerlOptions +Parent     
<LocationMatch /path2/>          SetHandler perl-script          
PerlResponseHandler Module::Test     </LocationMatch></VirtualHost> Please help 
me with this, Thanks in advance.Regards,uttam                                   
     

Reply via email to