httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Bond" <jamesbond_...@hotmail.com>
Subject [users@httpd] mod_rewrite and rewritemap
Date Fri, 01 Aug 2003 21:23:26 GMT
Hi,
I am running apache 2.0.47 with rewrite+proxy module. After some struggle I 
managed to get it working. This whole solution is complex but interesting.
I am  still having few problems with rewritemap and rewriterules.

Details:
----------
Redhat Linux
Apache 2.0.47
mod_rewrite, mod_proxy

Following are my rewrite rules:

RewriteMap    lb      prg:/usr/local/apache/current/conf/program.pl
RewriteRule   ^/(.*)  ${lb:$1\&%{query_string}}           [P,NC]
Proxypassreverse  /  ${lb:$1}


The above rules executes a perl script and pass the complete URL including 
querystring to the perl program on STDIN. Perl program grabs the STDIN value 
and transform it to a new URL with querystring . The perl program then pass 
the new URL to apache rule using STDOUT. The apache has been configured to 
accept the URL: http://www.foo.com/login.jsp?username=ff&password=jj
Client must always  see the external URL:  http://www.foo.com/login.jsp
This setup works but I have few issues with it.

Following is my program.pl script

----------------------------------------------------
#!/usr/bin/perl
#
$| = 1;


# get query string
# loop reading from stdin
if ( $? == 0 ) {
while ( <STDIN> ) {

$URL1 = $_;

#code to process this URL

#Make a new URL
$URL2 = 
"http://192.100.100.1/client/login.jsp?query=login?username=jj&password=jj"

  print "$URL2$_";

}
}

Issue with the above rewrite rules and perl program:

1: perl program returns the value of $URL2 + $URL1. If I make the code from

print "$URL$_";
to
print $URL2;

The apache server just hangs and does not return anythng at all.

2: I have modified my application on 192.100.100.1 server  to accept and 
process the URL sent by the above perl script

http://192.100.100.1/client/login.jsp?query=login?username=jj&password=jj

Now the problem is the apache rewrite rules does not work properly and 
cannot rewrite the URL properly. The client browser tries to contact the 
internal URL and it fails.

Can anyone please help me?

Thanks
james

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message