Fix it!!

Postby Guest » Thu Jul 04, 2002 4:28 am


Tried registering but cannot login afterwards :sad:

I have a problem which is driving me insane.
I have three (possibly more to come) backend servers running JBoss/tomcat and I have an Apache server running in front of these servers. What I need is for my users to connect to Apache which is supposed to act as a proxy.
This means that user must connect to Apache and recieve answers from my backend servers through Apache, so that the users cannot directly access the backend servers.

But! furthermore users must log in through apache and based on the username entered, the proxy must contact the corresponding backendserver since they are running different applications.

The username provided must be sent along with the request to the backendserver and on top of all this I wish to hide the URL from the user so that he/she cannot see request-paramters.

So what I end up with is a user requsting something like :


recieving response from one of the backendservers without the URL being changed.

The request which the proxy server needs to send to the backendservers are on the form :


where <user> is the username from the loginpage.

That is, I need three things from this setup :

user login
proxy functionality
URL hiding

I have been examining mod_proxy, but that is kind of limited.
Then I have been examining mod_rewrite but I cant seem to be getting it to work correctly.

What I have tried is something like :

in a .htaccess file in e.g.


I have :

RewriteEngine on
RewriteRule ^(.*)$ http://backendserver:%{REMOTE_USER} [R]

This actually works although the long URL of the backend server is shown to the user :sad:

If I change the [R] flag to [P] the user recieves an URL looking like :

http://apacheserver/somepath/?paramter1 ... r=someuser

which does not work as intended, and the URL is showing.

-that got pretty long i must admit, does it make sense to you...

Does anyone know whether the setup I am requesting is at all possible?
Maybe it is not mod_rewrite I need to be looking at -maybe a PHP solution is needed, or something completely different??

Any suggestions, faint ideas or guidelines would be greatly appreciated!!

Lars Hammer

Postby Brett » Mon Aug 05, 2002 12:31 pm

You might want to try using PHP with the cURL library.
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm

Return to Security with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 1 guest