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
Solved

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

Posted on 2010-09-15
4
747 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

When working in a large software development team, whether you have many developers working on the same projects, or your project is linked to other projects; it is very important that developers regularly perform "get latest" to ensure that the cha…
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). #…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

856 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