WebDav重命名在Nginx后面安装的Apache mod_dav上失败

我正试图解决通过WebDav重命名文件的问题。 我们的堆栈由一台机器组成,通过Nginx,Varnish和Apache提供内容。 当您尝试重命名文件时,操作将失败,并显示当前正在使用的堆栈。

要连接到WebDav,客户端程序必须:

  1. 通过https:// host:443连接到NginX
  2. Nginx解开并转发请求到http:// localhost:81上的Varnish服务器
  3. Varnish通过http:// localhost:82将请求转发给Apache,通过mod_dav提供会话

这里有一个失败的重命名的例子:

$ cadaver https://webdav.domain/ Authentication required for Webdav on server `webdav.domain': Username: user Password: dav:/> cd sandbox dav:/sandbox/> mkdir test Creating `test': succeeded. dav:/sandbox/> ls Listing collection `/sandbox/': succeeded. Coll: test 0 Mar 12 16:00 dav:/sandbox/> move test newtest Moving `/sandbox/test' to `/sandbox/newtest': redirect to http://webdav.domain/sandbox/test/ dav:/sandbox/> ls Listing collection `/sandbox/': succeeded. Coll: test 0 Mar 12 16:00 

有关更多反馈,WebDrive Windows客户端在重命名操作上logging了一个错误502(错误的网关)和303(?)。 扩展日志提供了这些信息:

目标URI指的是不同的scheme或端口( https://主机名:443 )(想要: http://主机名:82 )。

其他一些限制:对NginX Webdav模块的调查表明,它并不能真正适合我们的需求,并且将webdavstream量转发到Apache不是一种select,因为我们不希望启用Apache SSL。

有什么办法欺骗mod_dav转发到另一个主机? 我打开想法:)。

(回到我使用Subversion的日子)我从Nginx SSL前端代理到Apache SVN有类似的问题。 假设Nginx的SSL前端是https://主机,我们想代理连接到内部的Apache SVN服务器http:// svn

当您尝试复制资源与Destination标头时,会出现问题:

 COPY /path HTTP/1.1 Host: host Destination: https://host/another_path 

如您所见, Destination标头仍包含https架构。 修复很明显 –

 location / { # to avoid 502 Bad Gateway: # http://vanderwijk.info/Members/ivo/articles/ComplexSVNSetupFix set $destination $http_destination; if ($destination ~* ^https(.+)$) { set $destination http$1; } proxy_set_header Destination $destination; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://svn; }