[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
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
?
777 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

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…
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). #…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

656 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