AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 121766
Accepted
heymatthew
heymatthew
Asked: 2010-03-12 19:20:53 +0800 CST2010-03-12 19:20:53 +0800 CST 2010-03-12 19:20:53 +0800 CST

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

  • 772

我正在尝试解决通过 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 客户端在重命名操作中记录了错误 502(错误网关)和 303 (?)。扩展日志提供了以下信息:

目标 URI 指的是不同的方案或端口(https://hostname:443)(想要:http://hostname:82)。

其他一些限制:对 NginX 的 Webdav 模块的调查表明它并不真正满足我们的需求,并且将 webdav 流量转发到 Apache 不是一种选择,因为我们不想启用 Apache SSL。

有什么方法可以欺骗 mod_dav 转发到另一台主机?我对想法持开放态度:)。

apache-2.2 nginx varnish webdav
  • 2 2 个回答
  • 6331 Views

2 个回答

  • Voted
  1. Best Answer
    Alexander Azarov
    2010-03-13T01:06:50+08:002010-03-13T01:06:50+08:00

    (回到我使用 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
    

    如您所见,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;
    }
    
    • 7
  2. Jang Ryeol
    2019-11-16T02:20:42+08:002019-11-16T02:20:42+08:00

    正如@Cnly 所说,如果原始标题和网址set中都有特殊字符,则 using 指令将不起作用。Destination(我不知道为什么)

    我使用 map 指令来解决这个问题。

    http {
        map $http_destination $http_destination_webdav {
            ~*https://(.+) http://$1;
            default $http_destination;
        }
    
        server {
            # ...server settings...
    
            location / {
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Destination $http_destination_webdav;
    
                proxy_pass http://svn;
            }
        }
    }
    
    • 1

相关问题

  • 阿帕奇的替代品

  • 如何强制我的网址始终以 www 开头?

  • 在 Linux Xen VPS 上优化 Apache 和 MySQL

  • mod_rewrite 不转发 GET 参数

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve