Hi Kris,

On Wed, Jan 2, 2013 at 10:11 PM, Wempa, Kristofer
<kristofer.we...@sig.com>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    devtoolsandcompone...@msx.bala.susq.com
>         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    devtoolsandcompone...@msx.bala.susq.com
>         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.
>


The ServerAlias directive does not have an implicit wildcard, meaning that
'ServerAlias redminetest' will not match the 'Host: redminetestcluster'
header. Since no virtualhost is specified for the host redminetestcluster,
Apache HTTPD will pick the default virtualhost for handling the request
which is always the first virtualhost defined.

To solve your problem you should change your ServerAlias so it will match
any Host starting with 'redminetest': ServerAlias redminetest*


Kind regards,

Mathijs Schmittmann



>
>         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: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>

Reply via email to