Re: Reverse proxy with mod_rewrite using RewriteRule [P]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/3/2 Daniel López Robles <dalopez@xxxxxxxxxxxx>:
> 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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux