【问题标题】:Is there a preferred nginx config to run wsgidav behind a reverse proxy?是否有首选的 nginx 配置在反向代理后面运行 wsgidav?
【发布时间】:2022-10-24 00:28:42
【问题描述】:

到目前为止,我只是使用

location /drive/ { # wsgidav 
  proxy_pass http://127.0.0.1:8080/; 
}

它似乎可以解决问题。我可以从 Windows 资源管理器中将文件放入服务器、获取它们、浏览目录等。 但是,我无法重命名服务器上的文件。当我尝试它时,我得到 502 Bad Gateway

14:57:44.803 - INFO    : 127.0.0.1 - (anonymous) - [2022-10-14 12:57:44] "MOVE /user/Downloads/Text.txt" dest="https://myserver.com/drive/user/Downloads/Text1.txt", length=0, depth=0, overwrite=F, elap=0.001sec -> 502 Bad Gateway

我在配置中遗漏了什么吗? 谢谢

【问题讨论】:

    标签: nginx wsgidav


    【解决方案1】:

    抱歉打扰了,自己找了一个。 将其留在这里,以防其他人发现它有用。

    有一个封闭的issue 关于文件无法在反向代理后面重命名的问题。一种解决方案建议“配置反向代理以将 Destination 标头的协议从 'https:' 重写为 'http:'”。

    我遵循了这个建议并在配置的服务器部分之外添加了一个映射规则

    map $http_destination $driveDestination { # otherwise MOVE results in a 502 Bad Gateway
        default $http_destination;
        "~*^https://myserver.com/drive/(.+)" /$1;
    }
    

    以及 webdav 驱动器的以下位置

    ## Begin - wsgidav
    location /drive/ { # trailing slash means it will be added
      proxy_pass http://127.0.0.1:8080/; # - trailing slash means location will be dropped
    
      # https://github.com/mar10/wsgidav/issues/183
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_buffering off;
      client_max_body_size 0;
      proxy_request_buffering off;
    
      proxy_set_header Destination $driveDestination; # result of map command above
    }
    
    ## End - wsgidav
    

    而且,唉,它有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-12
      • 2017-08-14
      • 1970-01-01
      • 2016-05-05
      • 2021-07-15
      • 1970-01-01
      相关资源
      最近更新 更多