You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Martin Lie <ma...@broadpark.no> on 2004/07/15 00:14:36 UTC

Configuration tips (and perhaps a small bug?)

(Note: I've rewritten this mail several times during the day, so it's
probably very incoherent. There should still be some valid points herein,
though. ;) Here goes...)

I've been fiddling about all day trying to configure Subversion as a
WebDAV-module in a VirtualHost-configuration on Apache 2.0.50. Ideally, this
was what I wanted:

#A The VirtualHost's URL, http://svn.mydomain.com/, should display a HTML
page (perhaps a guide to the repositories available under the VirtualHost).

#B Several http://svn.mydomain.com/<subdir> URLs, where the <subdir>s are
distinct repositories.

While it's easy to fulfil one of these requirements, getting both right at
the same time proved difficult. One obvious solution is to set up a
<Location> or <Directory> container for each of the subdirectories, but that
is against the principle of writing things only once, not scalable,
redundant, and is just generally a bad thing to do in a config file.

So, instead, I tried this (rather typical) configuration:

<VirtualHost *>
    ServerName   svn.mydomain.com
    DocumentRoot /services/http/svn.mydomain.com/html
    <Directory   /services/http/svn.mydomain.com/html>
        # Subversion/WebDAV and authorization
        DAV svn
        SVNParentPath      /services/subversion
        AuthzSVNAccessFile /usr/local/subversion/etc/permissions.conf

        # Authentication
        Require      valid-user
        AuthType     Basic
        AuthName     "MyDomain Subversion Repository"
        AuthUserFile /usr/local/subversion/etc/users.conf
    </Directory>
</VirtualHost>

Well, actually there are a few more directives than this (like access- and
error-logging), but those aren't important. Anyways - repositories in
subdirectories (#B) then works fine, but typing in only
http://svn.mydomain.com/ in a browser doesn't display the index.html file
(which exists in the DocumentRoot), but instead gives a 403 error and this
error_log entry:
[error] The URI does not contain the name of a repository.  [403, #190001]

No luck.

It seems the HTTP GET / request gets forwarded to the mod_dav_svn module.
This happens in spite of my using the SVNParentPath directive - I think it
should be apparent that the root URL never contains a repository itself when
using SVNParentPath. ;) The server isn't an intelligent being, however, and
consequently any HTML content in the DocumentRoot is simply ignored (because
DocumentRoot = DAV root, here).

Is there any way for the mod_dav_svn module to refuse processing requests to
the DAV root when SVNParentPath is used, so that Apache can process the
contents of DocumentRoot normally? I.e. instead of the error message above,
it returns the responsibility to Apache. I'm not an Apache module hacker so
I'm not sure if something like this would be possible, but if the
mod_dav_svn developers thinks it is, then perhaps this is an idea? :)


Thus, generally it seemed that if you want to cater for multiple
repositories by having a SVNParentPath directive inside a <Location /dir>
container (or <Directory /path/to/dir> container), then it's not possible to
serve any web content from the URL that corresponds to /dir (physically:
/path/to/dir).

Perhaps this is why everyone seems to have their DAV directive in a subdir
instead of at the root of their VirtualHost - i.e. use <Location /reposdir>
instead of just <Location />...


However, just before sending this mail (some hours ago) I remembered the
LocationMatch directive. So I set out to write a regexp that matched all
subdirs but not the root itself, so that the DAV module wouldn't be
triggered on the root. This is the general solution:

<LocationMatch "^/[^/]+/">
    ...
</LocationMatch>

But there were some problems with this:

It matches ALL subdirectories, even those that doesn't correspond to an
actual repository. Thus, if you try to reference the images/ subdirectory
from your index.html file in the DocumentRoot, the image request will be
grabbed by the DAV module instead. Obviously no image will be served, and
your error_log will be littered with messages to the effect of "unable to
access repository 'images'".

Even Apache's default aliases /icons (used for indexing) and /error (used
for all kinds of error message) will be affected, so whenever a 404 error
message should have been shown a 500 error shows up instead, and even more
error_log entries telling you that there is no 'error' repository (or
'icons' for that matter).

Re: Configuration tips (and perhaps a small bug?)

Posted by Martin Lie <ma...@broadpark.no>.
Martin Lie wrote:
> However, I'm starting to doubt that the LocationMatch solution works,
> after all. It works fine for browsing the repositories, but I get
> errors when trying to import to it. Seems like Apache forwards the
> full "^/(repos1|repos2|repos3)" string to the mod_dav_svn module!?
> Geez.

Yup. I get errors like these when using the LocationMatch version as
described in the first post:
[error] [client X.X.X.X] Invalid URI in request PROPFIND
%5E/(repos1%7Crepos2%7Crepos3)/repos1/!svn/vcc/default HTTP/1.1

Should this be filed as a bug, or is it simply not possible to use
LocationMatch with mod_dav_svn? If it's a bug, is it an Apache, DAV or
Subversion issue?

-- 
Martin Lie



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Configuration tips (and perhaps a small bug?)

Posted by Martin Lie <ma...@broadpark.no>.
Martin Probst wrote:
> Why didn't you just create another subdir for the repositories?


Heh, no particular technical reason. Simply because I didn't want the extra
subdirectory. Less is more or something. ;)

However, I'm starting to doubt that the LocationMatch solution works, after
all. It works fine for browsing the repositories, but I get errors when
trying to import to it. Seems like Apache forwards the full
"^/(repos1|repos2|repos3)" string to the mod_dav_svn module!? Geez.

I'll investigate it further. ;)

-- 
Martin Lie



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Configuration tips (and perhaps a small bug?)

Posted by Martin Probst <ma...@martin-probst.com>.
Hi,
I couldn't find something good to snip, but this is in reply to the
first part of your message (subdir thing):
Why didn't you just create another subdir for the repositories?
Like
svn.mydomain.com/index.html
                 images/logo.gif
                 repos/reposA
                 repos/reposB
                 repos/reposC
That way you could use the SVNParentPath directive on repos and
everything would be fine, wouldn't it?

mfg
Martin


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Configuration tips (and perhaps a small bug?)

Posted by Martin Lie <ma...@broadpark.no>.
Martin Probst wrote:
>>> How about using the URL rewriting engine.
> 
> Just a note on that, one should really be careful with these Matching
> directives and mod_rewrite. It can _really_ cost you performance,
> especially when defined in .htaccess files.

Thanks for pointing this out.


> Your problem does not seem
> to really need a regular expression solution and if you have a big
> repository and many users it might be worth trying to find another
> solution.

Actually, I wouldn't call it a problem. It's more of a configuration
challenge. But if you don't want to use regular expressions,
rewriting, nor one <Location> container for each and every
repository - what solutions are left? I'm at a loss.

And is the regexp "solution" really meant to go haywire like it does?

-- 
Martin Lie


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Configuration tips (and perhaps a small bug?)

Posted by Martin Probst <ma...@martin-probst.com>.
Hi,

> > How about using the URL rewriting engine.

Just a note on that, one should really be careful with these Matching
directives and mod_rewrite. It can _really_ cost you performance,
especially when defined in .htaccess files. Your problem does not seem
to really need a regular expression solution and if you have a big
repository and many users it might be worth trying to find another
solution.

mfg
Martin


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Configuration tips (and perhaps a small bug?)

Posted by Martin Lie <ma...@broadpark.no>.
Felix Collins wrote:
> How about using the URL rewriting engine.  That way you could redirect
> you root requests to a different file and only pass the valid
> directory requests to the svn module.
> Hope that helps...


Good idea. Haven't used it before, but I'll look it up. Thanks. :)

-- 
Martin Lie


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Configuration tips (and perhaps a small bug?)

Posted by Felix Collins <fe...@keyghost.com>.
How about using the URL rewriting engine.  That way you could redirect 
you root requests to a different file and only pass the valid directory 
requests to the svn module.
Hope that helps...
Felix

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org