httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Evans <tevans...@googlemail.com>
Subject Re: [users@httpd] Reverse proxy with mod_rewrite using RewriteRule [P]
Date Tue, 02 Mar 2010 16:53:28 GMT
2010/3/2 Daniel López Robles <dalopez@acotelsa.com>:
> Hello:
>
> We have two Apaches in a server:
>
> Apache 2.2.14, reverse proxy, listening to IP 192.168.24.X
> Apache 2.2.11, which actually serves the websites, listening to IP
> 192.168.24.Y
>
> Domain name proxy.mysite.es points to our reverse proxy Apache, and we need
> it to send requests to the other Apache in this way:
>
> http://proxy.mysite.es/something -> http://something.mysite.es
>
> Our rewrite rule:
>
> RewriteRule ^/(.*) http://$1.mysite.es/ [L,P]

This looks very wrong.

>
> In RewriteLog we can see that the rewrite rule is working fine up to some
> point:
> ....
> [pre.mysite.es/sid#db73a0][rid#eef078/initial] (2) rewrite '/something' ->
> 'http://something.mysite.es/'
> ...
> [pre.mysite.es/sid#db73a0][rid#ef3088/initial] (2) rewrite
> '/public/index.aspx' -> 'http://public/index.aspx.mysite.es/'

as these two lines point out.

If you request the URL http://proxy.mysite.es/foo/bar.html on the
proxy, your rule says to rewrite this to http://foo/bar.html.mysite.es
- does that LOOK right?!

I would do this much more explicitly, rather than allow the users to
specify the hosts that we will proxy to:

ProxyPass /something/ http://something.mysite.es/
ProxyPassReverse /something/ http://something.mysite.es/
ProxyPassReverseCookieDomain something.mysite.es proxy.mysite.es

and then repeat those lines for each host that you wish to be proxied.

If you really can't do this, and must have it dynamic, then I suggest
a regular expression tutorial :)

Cheers

Tom

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