问题
I am trying to make our subversion repository accessible via multiple URLs. To do so, I was thinking to use the LocationMatch directive. My configuration is:
<Location ~ "/(svn|repository)">
DAV svn
SVNPath /opt/svn
AuthzSVNAccessFile /etc/subversion/access
</Location>
The above configuration does NOT work ... Strange thing is that if i use for example this configuration, it works well for both URLs:
<Location ~ "/(svn|repository)">
SetHandler server-status
</Location>
For me it looks like the combination of DAV svn and LocationMatch does not really work... or am I doing something wrong here?
回答1:
I too am having problems with as I wanted to use regexs to avoid other subpaths getting caught by my match.
e.g.
<LocationMatch "^/test/.*$>
is not the same as
<Location "/test">
as in the latter, http://site.com/newproduct/test would get caught by the last one, but not the first one. So would http://site.com/test/scripts . This is why LocationMatch exists, but it fails whenever I put in regexs. It appears to work if I use LocationMatch w/o any regular expressions though.
回答2:
Does the client get an error, and is there an error in the HTTP error logs?
SVN may get confused you map multiple locations to a single SVN Repo. See http://subversion.apache.org/faq.html#http-301-error . I'm troubleshooting this for another problem right now.
Does it work if you remove the regular expression? I'll assume yes, but I wanted to verify.
<Location "/svn">
回答3:
The problem seems to be that when you use regular expressions in your Location
or LocationMatch
section, the Apache server is rewriting some metadata on the request with the content of the regular expression (possibly to let the handler that takes this request that it was targeted by a regular expression).
When the dav_svn handler gets the request, it consults this metadata to resolve the path it needs to take to get the resource being asked. Because the regular expression is not a real path, you get errors like this:
svn: PROPFIND of '%5E/(svn%7Crepository)/!svn/vcc/default': Could not parse response status line
I don't have any fix for that, except not using regular expressions with dav_svn: in my case I wanted to use an XSLT formatter to show a nice UI for the subversion repository when accessing it using a web browser, and the XSL resources were supposed to be accessed on a different path on the same host name that hosts the subversion repo, so I wanted to use a regular expression Location
to have the path to the XSL resources not hit the dav_svn handler. This was a bust, so instead I just deployed websvn on a different host name and that was that.
回答4:
fast solution that works: just add your reference to each vhost, you want to make the svn repro accessible.
来源:https://stackoverflow.com/questions/665799/locationmatch-and-dav-svn