Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Should I not be able to have a configuration where I serve SVN repos with SVNParentPath at <Location /> and then override DAV and host normal files using another location <Location /foo>? I wish to host my XSLT files on the same subdomain and still host repos at root. Of course, if I was to have a repo called foo, that would not be accessible, and that's ok.

<VirtualHost *:80>
    ...
    #Host XSLT files here
    <Location /foo>
        DAV Off
    </Location>

    #Host my repos relative to root, such as /my_repo/
    <Location />
        DAV svn     
        SVNParentPath "myrepos"
        SVNListParentPath on
        SVNIndexXSLT "/foo/my.xsl"
        ...
    </Location>
</VirtualHost>

But DAV SVN still looks for a repo:

<?xml version="1.0" encoding="utf-8"?>
<D:error xmlns:D="DAV:" xmlns:m="http://apache.org/dav/xmlns" xmlns:C="svn:">
<C:error/>
<m:human-readable errcode="720003">
Could not open the requested SVN filesystem
</m:human-readable>
</D:error>

Edit: I read up on mod rewrite a bit and so far as I understand it the target path of a rewrite rule can only be local unless you use redirect [R]. This for example works, it creates a redirect (HTTP 302):

RewriteEngine On
RewriteRule ^/foo/(.*)$ http://someotherhost/foo/$1 [R]

However, it still doesn't work with SVNIndexXSLT. Probably because it doesn't follow redirects.

share|improve this question

3 Answers 3

"Note, that once you have DAV enabled for some location, it cannot be disabled for sublocations." (emphasis theirs)

You can try mod_rewriting your way out of this one. If you had a

RewriteRule ^/foo/(.*)$ /some/local/directory/$1 [L]

Theoretically that might evade DAV, since without the PT flag it shouldn't hand the request off to any other module. Worth a shot, at least.

If it doesn't work, be sure to reply to this so someone else trying this will see that it can't be done ;)

share|improve this answer
    
I'll try that, thanks –  mandrake Jan 7 '11 at 18:26
    
Ok, I've tried it and it works, sort of. But not with SVNIndexXSLT. See my edited question for details. –  mandrake Jan 9 '11 at 12:02
    
@mandrake: My guess is that SVNIndexXSLT is used by mod_svn_dav internally so it needs to be stored locally. Maybe you could make a separate /xslt folder and use /foo for everything else? –  DerfK Jan 9 '11 at 15:03
    
You mean to have the repos served under /repos/*? Yeah, that would work, but I was trying to avoid it. And if I had the repos there I wouldn't need the rewrite either since DAV can be disabled. –  mandrake Jan 10 '11 at 7:23

Simply host svn at svn.example.com, and keep / for normal http.

share|improve this answer
    
Do you mean to host at svn.example.com/svn and root for normal hosting? I wanted to avoid that solution. Or do you mean to configure SVNIndexXSLT to point at another host? Because that's not supported. –  mandrake Jan 9 '11 at 11:50

Did you ever work out an answer to this? I happen to be trying the exact same configuration right now and I'm running into the same problem as you.

For what it's worth there is half a solution for you - provided the ability to automatically list repositories (with SVNListParentPath On) isn't critical to you.

You could use the SVNPath directive instead - thus you would have something like:

<Location />
     SVNIndexXSLT "/repos-web/view/repos.xsl"
     # Other common options, such as Auth options can go here
</Location>

<Location /repository1>
     SVNPath /var/lib/svn/repositories/repo1
     DAV svn
</Location>

<Location /repository2>
     SVNPath /var/lib/svn/repositories/repo2
     DAV svn
</Location>

<Location /repository3>
     SVNPath /var/lib/svn/repositories/repo3
     DAV svn
</Location>

Obviously, if you're running a setup where you create new repositories regularly (repository per project approach) then this won't be very appealing to you. But it'll do for a small, fixed, number of repositories.

You could then drop a hard coded index.htm in the apache document root if you wanted something user friendly to appear at http://svn.yourdomain.com/

I've tested this approach and it works. Shame about losing the auto-generated list of repositories though (and having to map each repository in the httpd.conf)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.