You need only one VH really to handle both:
<VirtualHost *>
ServerAdmin [email protected]
ServerName sdlcdevbal832
*ServerAlias redmine redminetest*
RewriteEngine On
# Redirect all non-static requests to cluster for redmine
# Redirect the rest to 127.0.0.1:4000
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} !^redminetest$
RewriteRule ^/(.*)$ balancer://redminecluster%{REQUEST_URI}
[P,QSA,L]
RewriteRule (.*) http://127.0.0.1:4000$1
</VirtualHost>
On Thu, Jan 3, 2013 at 8:11 AM, Wempa, Kristofer <[email protected]>wrote:
>
> I'm trying to do something slightly different than is described in the
> Apache documentation that I've read. We have an internal Linux server that
> uses Apache as a load-balancer + URL redirector to a Redmine instance
> running a Thin web server on localhost ports 3000-3002. We have a
> "redmine" alias that we are load balancing among these 3 ports with the
> following VirtualHost entry:
>
> <VirtualHost *>
>
> ServerAdmin [email protected]
> ServerName sdlcdevbal832
> ServerAlias redmine
>
> RewriteEngine On
>
> # Redirect all non-static requests to cluster
> RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
> RewriteRule ^/(.*)$ balancer://redminecluster%{REQUEST_URI}
> [P,QSA,L]
>
> </VirtualHost>
>
> <Proxy balancer://redminecluster>
> BalancerMember http://127.0.0.1:3000
> BalancerMember http://127.0.0.1:3001
> BalancerMember http://127.0.0.1:3002
> </Proxy>
>
> However, we also have a separate test Redmine instance running on port
> 4000. We created a "redminetest" alias and we want all URLs that start
> with "http://redminetest" to be redirected to port 4000 (no load
> balancing) while URLs that start with "http://redmine" to continue to be
> load-balanced on ports 3000-3002. We created the following additional
> VirtualHost entry:
>
> <VirtualHost *>
>
> ServerAdmin [email protected]
> ServerName sdlcdevbal832
> ServerAlias redminetest
>
> RewriteEngine On
>
> # Redirect all non-static requests to cluster
> RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
> RewriteRule ^/(.*)$ balancer://redminetestcluster%{REQUEST_URI}
> [P,QSA,L]
>
> </VirtualHost>
>
> <Proxy balancer://redminetestcluster>
> BalancerMember http://127.0.0.1:4000
> </Proxy>
>
> Unfortunately, this did not work. It resulted in URLs with both the
> "redmine" and "redminetest" aliases being sent to the load-balanced
> production instance. Can somebody explain what we are doing wrong ? The
> Apache documentation isn't clear about how the server matches VirtualHost
> entries and we've obviously done something wrong. Any help would be
> greatly appreciated. Thanks.
>
> Kris
>
>
> ________________________________
>
> IMPORTANT: The information contained in this email and/or its attachments
> is confidential. If you are not the intended recipient, please notify the
> sender immediately by reply and immediately delete this message and all its
> attachments. Any review, use, reproduction, disclosure or dissemination of
> this message or any attachment by an unintended recipient is strictly
> prohibited. Neither this message nor any attachment is intended as or
> should be construed as an offer, solicitation or recommendation to buy or
> sell any security or other financial instrument. Neither the sender, his or
> her employer nor any of their respective affiliates makes any warranties as
> to the completeness or accuracy of any of the information contained herein
> or that this message or any of its attachments is free of viruses.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>