?
Solved

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

Posted on 2010-09-15
4
Medium Priority
?
763 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 2000 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

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Article by: gr8gonzo
Git can be a complicated version control system for beginners, but it definitely is one of the best ones out there. Since this article assumes that you're starting at square one, it will skip over things that Git -can- do and will focus on the typic…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

777 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