hey*_*hew 4 nginx varnish webdav apache-2.2
我正在尝试解决通过 WebDav 重命名文件的问题。我们的堆栈由一台机器组成,通过 Nginx、Varnish 和 Apache 提供内容。当您尝试重命名文件时,操作会因我们当前使用的堆栈而失败。
要连接到 WebDav,客户端程序必须:
以下是重命名失败的示例:
$ 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
Run Code Online (Sandbox Code Playgroud)
有关更多反馈,WebDrive Windows 客户端在重命名操作中记录了错误 502(Bad Gateway)和 303(?)。扩展日志提供了以下信息:
目标 URI 指的是不同的方案或端口(https://hostname:443)(想要:http://hostname:82)。
其他一些限制:对 NginX 的 Webdav 模块的调查表明它并不真正符合我们的需求,并且将 webdav 流量转发到 Apache 不是一种选择,因为我们不想启用 Apache SSL。
有没有办法欺骗 mod_dav 转发到另一台主机?我对想法持开放态度:)。
(回到我使用 Subversion 的日子)我在从 Nginx SSL 前端代理到 Apache SVN 时遇到了类似的问题。假设 Nginx SSL 前端是 https://host 并且我们想要代理连接到内部 Apache SVN 服务器 http://svn
当您尝试使用Destination标头复制资源时会出现问题:
COPY /path HTTP/1.1
Host: host
Destination: https://host/another_path
Run Code Online (Sandbox Code Playgroud)
如您所见,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;
}
Run Code Online (Sandbox Code Playgroud)