有没有一个首选的nginx配置来在反向代理后面运行wsgidav



到目前为止,我只使用

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

它似乎起到了作用。我可以将文件放入服务器,获取它们,浏览目录等,所有这些都来自Windows资源管理器。但是,我无法重命名服务器上的文件。当我尝试它时,我得到502坏网关

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

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

Sry为噪音,自己找到了一个。我会把这个留在这里,以防其他人发现它有用。

关于无法在反向代理后重命名文件的问题,存在一个已解决的问题。建议的一种解决方案是";配置反向代理以将目标标头的协议从"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

唉,它起作用了。

最新更新