Solved

How do I use Apache's mod_rewrite as a software load balancer without redirection for SVN?

Posted on 2010-09-15
4
753 Views
Last Modified: 2013-11-25
I would like to use Apache's mod_rewrite module as a software load balancer for a number of SVN servers. My setup is like this:

team1.svn.mycompany.com = SVN server dedicated to Team #1
team2.svn.mycompany.com = SVN server dedicated to Team #2
...
team5.svn.mycompany.com = SVN server dedicated to Team #3

I'd like to have everyone use the same URL to access SVN. Something like this:

svn.mycompany.com

Depending on the repository name, I'd like an Apache instance to reroute traffic to the correct SVN server. Example:

svn.mycompany.com/repository_a reroutes to team1.svn.mycompany.com/repository_a
svn.mycompany.com/repository_b reroutes to team2.svn.mycompany.com/repository_b

I tried creating my own rewrite rules, but unfortunately, when I try to connect to the repository using TortoiseSVN or similar SVN client, I get an error message that the repository has moved temporarily. So it appears that the SVN client is detecting the redirect. I thought rewrite was supposed to avoid this.

If rewrite isn't the correct solution, can anyone offer a viable alternative?
0
Comment
Question by:nwstout
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:gremwell
ID: 33686650
I think mod_rewrite should work for you, it works transparently and cannot be "detected" by the clients.

Looks like this guy http://blog.barfoo.org/2008/09/28/subversion-via-https-and-mod_rewrite/ has managed to solve the problem, he also experienced problems with redirect first.
0
 

Author Comment

by:nwstout
ID: 33687158
Thanks for the response. This didn't seem to solve the problem I am facing. Looks like the guy you referenced forgot to close his string bracket. I'm not having that issue.

I have tried several rules but have opted for the most basic setup I could get... still not working. This is the most basic rule I have tried:

RewriteEngine On
RewriteRule ^/$(.*)  http://team1.svn.mycompany.com/$1 [L,R]

My understanding is that this should route all traffic to the Apache server to team1.svn.mycompany.com and just pass everything in the URI string. However, when I do this, I still get:

ERROR: Respository moved temporarily to
ERROR: 'http://team1.svn.mycompany.com/repo1'; please relocate

I have tried with and without the [R] flag. The help text on the Redirect flag says "By default, R will send a 302 temporarily moved header, whereas R=301 will send a 301 permanently moved header."

Any other ideas?
0
 
LVL 5

Accepted Solution

by:
SimonDard earned 500 total points
ID: 33690623
Mod_rewrite does what it is supposed to do: redirect traffic. This is because you specify an [R] and also because the redirect contains a domain. mod_rewrite (or basic Apache) can not get data for you from sources it can not access through the filesystem.

Either use NFS to have data locally available for Apache or use mod_proxy to fetch data from remote servers (possibly in conjunction with mod_rewrite).

0
 

Author Comment

by:nwstout
ID: 33717311
Thanks, SimonDard. I think you're right. It makes sense that it would work correctly with the proxy feature enabled, but that would defeat my purpose of having multiple servers as everything would tunnel through a single server.

I was hoping someone else had a creative solution.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question