Solved

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

Posted on 2010-09-15
4
742 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
  • 2
4 Comments
 
LVL 3

Expert Comment

by:gremwell
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now