LocationMatch 和 DAV svn

发布于 2024-07-15 22:44:51 字数 463 浏览 6 评论 0原文

我正在尝试使我们的 Subversion 存储库可以通过多个 URL 进行访问。 为此,我考虑使用 LocationMatch 指令。 我的配置是:

<Location ~ "/(svn|repository)">
  DAV svn
  SVNPath /opt/svn
  AuthzSVNAccessFile /etc/subversion/access
</Location>

上面的配置不起作用。 奇怪的是,如果我使用这个配置,它对两个 URL 都适用:

<Location ~ "/(svn|repository)">
  SetHandler server-status
</Location>

对我来说,看起来 DAV svn 和 LocationMatch 的组合并没有真正起作用,或者我在这里做错了什么?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

转身以后 2024-07-22 22:44:51

我也遇到了问题,因为我想使用正则表达式来避免其他子路径被我的匹配捕获。

例如

<LocationMatch "^/test/.*
gt;

<Location "/test">

与后者不同, http://site.com/newproduct/test 被最后一个抓住,但不是第一个。 http://site.com/test/scripts 也是如此。 这就是 LocationMatch 存在的原因,但每当我放入正则表达式时它就会失败。 如果我使用不带任何正则表达式的 LocationMatch ,它似乎可以工作。

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/.*
gt;

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.

筱武穆 2024-07-22 22:44:51

问题似乎是,当您在 LocationLocationMatch 部分中使用正则表达式时,Apache 服务器会使用正则表达式的内容重写请求上的一些元数据(可能是为了让接受此请求的处理程序知道它是正则表达式的目标)。

当 dav_svn 处理程序收到请求时,它会查阅此元数据来解析获取所请求的资源所需的路径。 因为正则表达式不是真正的路径,所以你会得到这样的错误:

svn: PROPFIND of '%5E/(svn%7Crepository)/!svn/vcc/default': Could not parse response status line

除了不将正则表达式与 dav_svn 一起使用之外,我没有任何修复方法:在我的例子中,我想使用 XSLT 格式化程序来显示一个漂亮的 UI使用 Web 浏览器访问 Subversion 存储库时,XSL 资源应该在托管 Subversion 存储库的同一主机名上的不同路径上访问,因此我想使用正则表达式 Location 使 XSL 资源的路径不会命中 dav_svn 处理程序。 这是一个半身像,所以我只是将 websvn 部署在不同的主机名上,仅此而已。

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.

逆光飞翔i 2024-07-22 22:44:51

客户端是否收到错误,HTTP 错误日志中是否有错误?

SVN 可能会对您将多个位置映射到单个 SVN Repo 感到困惑。 请参阅 http://subversion.apache.org/faq.html#http-301 -错误。 我现在正在解决另一个问题。

如果去掉正则表达式还能用吗? 我假设是的,但我想验证一下。

<Location "/svn">

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">
不爱素颜 2024-07-22 22:44:51

快速有效的解决方案:只需添加对每个虚拟主机的引用,您想让 svn repro 可访问。

fast solution that works: just add your reference to each vhost, you want to make the svn repro accessible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文