# Mongrel steals my requests for my subversion repo

**URL:** <https://www.ruby-forum.com/t/mongrel-steals-my-requests-for-my-subversion-repo/132536>\
**Category:** Rails\
**Created:** [March 21, 2008, 4:34am UTC](https://www.ruby-forum.com/t/mongrel-steals-my-requests-for-my-subversion-repo/132536 "2008-03-21T04:34:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbobker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/73ab20/32.png) [@tbobker](https://www.ruby-forum.com/u/tbobker)\
**Post date:** [March 21, 2008, 4:34am UTC](https://www.ruby-forum.com/t/mongrel-steals-my-requests-for-my-subversion-repo/132536/1 "2008-03-21T04:34:19Z")

</div>

the kind folks on irc have tried to solve this for awhile and we have  
gotten very close to the problem.

My config file for apache is working, except mongrel tries to interpret  
my request ([myserver.com/svn](http://myserver.com/svn)) as a request for a page on my site, and,  
not finding anything, returns a 404.

Basically, if i turn the rewrite engine off, then my svn works great.  
however, it seems like this would be a common problem and i thought i  
would ask here if there is something simpler than me writing a custom  
RewriteRule.

thanks for any help.

tim

Here is my site.conf  
\<Proxy balancer://mongrel\_cluster\>  
BalancerMember [http://127.0.0.1:8000](http://127.0.0.1:8000)  
BalancerMember [http://127.0.0.1:8001](http://127.0.0.1:8001)

\<VirtualHost \*:80\>  
ServerName [mysite.com](http://mysite.com)

DocumentRoot /var/www/apps/mysite/current/public

```
    ErrorLog /var/log/apache2/svn-error_log
    CustomLog /var/log/apache2/svn-access_log combined

```

\<location /svn\>  
DAV svn  
SVNPath /svn

```
       AuthType Basic
       AuthName "Subversion Repository"
       AuthUserFile /etc/apache2/dav_svn.passwd
       Require valid-user

```

\<Directory /var/www/apps/mysite/current/public \>  
Options FollowSymLinks  
AllowOverride All  
Order allow,deny  
Allow from all

RewriteEngine On

# Check for mx file

RewriteCond %{DOCUMENT\_ROOT}/system/maintenance.html -f  
RewriteCond %{SCRIPT\_FILENAME} !maintenance.html  
RewriteRule ^.\*$ /system/maintenance.html [L]

# Rewrite index to check for static

RewriteRule ^/$ /index.html [QSA]

# Rewrite to check from Rails cached page

RewriteRule ^([^.]+)$ $1.html [QSA]

# redirect all non-static requests to cluster

RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} !-f  
RewriteRule ^/(.\*)$ balancer://mongrel\_cluster%{REQUEST\_URI} [P,QSA,L]

---

<div class="post-metadata">

**Author:** ![tbobker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/73ab20/32.png) [@tbobker](https://www.ruby-forum.com/u/tbobker)\
**Post date:** [March 21, 2008, 5:01am UTC](https://www.ruby-forum.com/t/mongrel-steals-my-requests-for-my-subversion-repo/132536/2 "2008-03-21T05:01:44Z")

</div>

Tim B. writes:

> the kind folks on irc have tried to solve this for awhile and we  
> have  
> gotten very close to the problem.
> 
> My config file for apache is working, except mongrel tries to  
> interpret  
> my request ([myserver.com/svn](http://myserver.com/svn)) as a request for a page on my site,  
> and,  
> not finding anything, returns a 404.
> 
> Basically, if i turn the rewrite engine off, then my svn works  
> great.  
> however, it seems like this would be a common problem and i thought  
> i  
> would ask here if there is something simpler than me writing a  
> custom  
>   
> \<location /svn\>  
> \<Directory /var/www/apps/mysite/current/public \>
> 
> # Check for mx file
> 
> RewriteCond %{DOCUMENT\_ROOT}/system/maintenance.html -f  
> RewriteCond %{SCRIPT\_FILENAME} !maintenance.html  
> RewriteRule ^.\*$ /system/maintenance.html [L]

I suggest you fix this by forcing Apache to process the SVN urls here.  
Create your REWRITE rule to catch the SVN requests and stop it [L]  
from being processed in subsequent rules.

– Long  
[http://FATdrive.tv/wall/trakb/10-Long](http://FATdrive.tv/wall/trakb/10-Long)  
[http://FATdrive.tv/](http://FATdrive.tv/) - store, play, share

---

<div class="post-metadata">

**Author:** ![tbobker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/73ab20/32.png) [@tbobker](https://www.ruby-forum.com/u/tbobker)\
**Post date:** [March 23, 2008, 1:22am UTC](https://www.ruby-forum.com/t/mongrel-steals-my-requests-for-my-subversion-repo/132536/3 "2008-03-23T01:22:20Z")

</div>

For future googlers and those who are following this:

solution was to stop the RewriteRule from happening – not to redirect  
svn and then stop – this causes a dreaded 301 error since the  
subversion repo wants [http://mysite.com/svn](http://mysite.com/svn) and apache gives it  
[http://mysite.com/svn/](http://mysite.com/svn/). anyway here is my workaround:

# redirect all non-static requests to cluster

```
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/svn
    RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} 

```

[P,QSA,L]

HTH,

tim

Long wrote:

> Tim B. writes:
> 
> > the kind folks on irc have tried to solve this for awhile and we  
> > have  
> > gotten very close to the problem.
> > 
> > My config file for apache is working, except mongrel tries to  
> > interpret  
> > my request ([myserver.com/svn](http://myserver.com/svn)) as a request for a page on my site,  
> > and,  
> > not finding anything, returns a 404.
> > 
> > Basically, if i turn the rewrite engine off, then my svn works  
> > great.  
> > however, it seems like this would be a common problem and i thought  
> > i  
> > would ask here if there is something simpler than me writing a  
> > custom  
> >   
> > \<location /svn\>  
> > \<Directory /var/www/apps/mysite/current/public \>
> > 
> > # Check for mx file
> > 
> > RewriteCond %{DOCUMENT\_ROOT}/system/maintenance.html -f  
> > RewriteCond %{SCRIPT\_FILENAME} !maintenance.html  
> > RewriteRule ^.\*$ /system/maintenance.html [L]
> 
> I suggest you fix this by forcing Apache to process the SVN urls here.  
> Create your REWRITE rule to catch the SVN requests and stop it [L]  
> from being processed in subsequent rules.
> 
> – Long  
> [http://FATdrive.tv/wall/trakb/10-Long](http://FATdrive.tv/wall/trakb/10-Long)  
> [http://FATdrive.tv/](http://FATdrive.tv/) - store, play, share
