httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boyle Owen" <Owen.Bo...@swx.com>
Subject RE: [users@httpd] Differences between ProxyPass and RewriteRule
Date Fri, 03 Sep 2004 07:53:38 GMT
> -----Original Message-----
> From: Aubrey Hutchings [mailto:aubreyh@ee.byu.edu]
> Sent: Donnerstag, 2. September 2004 23:38
> To: users@httpd.apache.org
> Subject: [users@httpd] Differences between ProxyPass and RewriteRule
> 
> 
> Hello.
> 
> I've figured out three ways to solve my problem and on the 
> surface, they
> *seem* to do the same thing. However, out of curiousity I'm wondering
> what differences, if any, are going on in the background.
> 
> Basically what I am doing is telling Apache to fetch pages off of
> another server, but not look like it is doing so. For example, when
> people come to: http://www.fake.com/bob I want Apache to send them to
> http://www.notreal.com/bob without them seeing in the URL bar that
> anything has changed. 
> 
> So, here are the three ways I found... can anyone tell me about the
> nuances between these different versions or where I might find a
> comparison in the documentation?
> 
> Way #1
> RewriteRule ^/bob/(.*)$ http://www.notreal.com/bob/$1  [P,R]  

P = proxy and R = redirect. The two are mutually exclusive. I assume
that the "R" is just being ignored...

> Way #2
> RewriteRule ^/alumni/(.*)$ http://www.et.byu.edu/~aubreyh/alumni/$1
[P]    

...in which case, these two are identical.

So 1&2 basically use mod_rewrite to generate the new URL then hand the
whole thing off to mod_proxy for proxying.

>Way #3
>ProxyPass           /bob/   http://www.notreal.com/bob/
>ProxyPassReverse    /bob/   http://www.notreal.com/bob/  

Because the substitution is simple, you can do it directly in mod_proxy
and have no need for mod_rewrite. If you had a more complicated rewrite
where the redirected URL depended on the input, then you might need to
use mod_rewrite, eg:

RewriteRule ^/bob/a/(.*)$ http://www.notreal.com/aa/cgi/prog?a=$1  [P]  
RewriteRule ^/bob/b/(.*)$ http://www.notreal.com/bb/cgi/prog?b=$1  [P]  

Basically, if its a straight mapping of one webspace into another (with
same URLs) then mod_proxy is simpler and quite adequate. If there are
complicated conditional relationships between the two sites then you
need to use mod_rewrite.

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 

Diese E-mail ist eine private und persönliche Kommunikation. Sie hat
keinen Bezug zur Börsen- bzw. Geschäftstätigkeit der SWX Gruppe. This
e-mail is of a private and personal nature. It is not related to the
exchange or business activities of the SWX Group. Le présent e-mail est
un message privé et personnel, sans rapport avec l'activité boursière du
Groupe SWX.

This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please notify the sender urgently
and then immediately delete the message and any copies of it from your
system. Please also immediately destroy any hardcopies of the message.
You must not, directly or indirectly, use, disclose, distribute, print,
or copy any part of this message if you are not the intended recipient.
The sender's company reserves the right to monitor all e-mail
communications through their networks. Any views expressed in this
message are those of the individual sender, except where the message
states otherwise and the sender is authorised to state them to be the
views of the sender's company. 



---------------------------------------------------------------------
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