`svn checkout` on the SVN server causes the repo to break with a 301 error
- by Phillip Oldham
We have an nginx server which proxies to a standard set-up of Apache+SVN. The nginx set-up is a very simple proxy:
server {
server_name svn.ourdomain.tld;
location / {
proxy_pass http://localhost:8080;
}
}
Apache is set-up as follows:
<Location />
DAV svn
SVNParentPath /var/svn
AuthType Basic
AuthName "Authentication Required"
AuthUserFile /var/svn/.auth
Require valid-user
</Location>
...which allows us to access repositories using something like http://svn.ourdomain.tld/repo. We've been running this set-up now for about 2 years without issue.
Recently we've found that we need to check out one of the repositories onto the server itself, however whenever we do so it seems to break the repo. From that point on, it will only respond with a 301 Moved Permanently error.
We've tried:
svn co file:///path/to/repo
svn co svn://localhost/repo
svn co svn://svn.ourdomain.tld/repo
svn co svn+ssh://localhost/repo
svn co svn+ssh://svn.ourdomain.tld/repo
svn co http://localhost/repo
svn co http://svn.ourdomain.tld/repo
Also tried bypassing nginx, and get the same error:
svn co http://localhost:8080/repo
svn co http://svn.ourdomain.tld:8080/repo
Checking out from a different machine works as expected until we attempt to check out on the server, after that it refuses with the same 301 error.
What is more confusing is that this repository server also hosts our HudsonCI server, which can pulls and builds our projects hourly. This leads us to suspect that it's the svn client which is causing an error in communication.
Its also very confusing that removing then re-creating the repo using svnadmin doesn't reset the error - the repo is still unavailable even though it's "new"! Restarting apache and subversion (svnserve) has no effect on this, or the original error.
Version information:
OS: 64-bit CentOS 4.2, 2.6.27 kernel
svn client: 1.4.2 (same for both server and remote clients)
svn server: 1.4.2
httpd: 2.2.3
UPDATE:
This also happens with svn export when run on the repo server. Ran from any other box/client, there isn't a problem. Here's the workflow, to help clarify the error:
[~repo-server~]# svnadmin create {repo}; chown -Rf www:www {repo}
[remote-client]# svn checkout http://svn.ourdomain.tld/repo
[remote-client]# svn add file; svn ci -m ''
[~repo-server~]# cd /var/www; svn export file:///path/to/repo/trunk ourproject
[remote-client]# svn update fails with 301 error
I can also confirm that the hostname of the box doesn't have an effect here, which is very odd: whether or not svn.ourdomain.tld is added to /etc/hosts it still breaks - we thought it could be an issue with localhost routing, but that doesn't seem to be the case.
Are we missing something in the documentation which states you can't checkout a repo when the server is on the same box? How can we stop the repos becoming corrupt when we checkout locally?