webdav icon indicating copy to clipboard operation
webdav copied to clipboard

After nginx anti-generation, it is impossible to rename the file location and cannot move other functions.

Open buse88 opened this issue 6 months ago • 10 comments

Image What is the reason for this? If you don't set nginx anti-generation, there will be no problem.

buse88 avatar Jun 09 '25 03:06 buse88

I'm not sure what you mean by "nginx anti-generation". Could you clarify?

hacdias avatar Jun 14 '25 12:06 hacdias

The software did not provide an accurate translation, let me clarify again。If I use the directly through the software raidrive, there is no problem. After using nginx, I cannot rename and move it.

buse88 avatar Jun 14 '25 12:06 buse88

Did you follow the instructions to use reverse proxies? https://github.com/hacdias/webdav#reverse-proxy-service

You need to correctly forward the destination header.

hacdias avatar Jun 14 '25 12:06 hacdias

Yes, the following is my configuration (domain name is just a substitute)

Image

buse88 avatar Jun 14 '25 13:06 buse88

What does the error say? Which WebDAV client are you using? Do you have the same issue without Nginx?

hacdias avatar Jun 14 '25 13:06 hacdias

No use nginx no problem,The client used is RaiDrive URL:https://www.raidrive.com/

buse88 avatar Jun 14 '25 13:06 buse88

use nginx Error message: File access denied You need the permission provided by S-1-1-0 to modify this file

buse88 avatar Jun 14 '25 13:06 buse88

Do you have any logs provided by webdav that could help debug this? This definitely looks like some issue when reverse proxying, but I don't think I can help a lot without more information.

hacdias avatar Jun 14 '25 13:06 hacdias

2025-06-14 21:37:09.161 [ERROR] RD : WebDAV(WebDAV) : Get Sub Folder List Error : /proc : Exception : {"WinErrorCode":1460,"NotifyErrorCode":213,"RaiException":"WebDAV List : /proc/ : Failed : ","Filename":"/proc/","WebExceptionStatus":"Timeout","InnerException":"Response reading timeout."} 2025-06-14 21:37:44.531 [ERROR] API : WebDAV(WebDAV) : RenameFile : 新建 文本文档.txt : Exception : {"WinErrorCode":5,"NotifyErrorCode":107,"RaiException":"MOVE Failed : ","Filename":"/新建 文本文档.txt","WebExceptionStatus":"ProtocolError","InnerException":"403 Forbidden","WebResponseCode":403,"HttpException":"Forbidden : Forbidden","HttpReferenceMessage":"Forbidden"} 2025-06-14 21:37:44.531 [ERROR] PA : DLLJKEDIOPFFKMLLJDHGCIKANBFFBMBNBIOP : explorer.exe(9472) : Rename Failed : /新建 文本文档.txt => /67890.txt : Exception : {"WinErrorCode":5,"NotifyErrorCode":107,"RaiException":"MOVE Failed : ","Filename":"/新建 文本文档.txt","WebExceptionStatus":"ProtocolError","InnerException":"403 Forbidden","WebResponseCode":403,"HttpException":"Forbidden : Forbidden","HttpReferenceMessage":"Forbidden"} 2025-06-14 21:37:44.531 [ERROR] FS : WebDAV(WebDAV) : Rename Failed : /新建 文本文档.txt => /67890.txt : Exception : {"WinErrorCode":5,"NotifyErrorCode":211,"RaiException":"{"WinErrorCode":5,"NotifyErrorCode":107,"RaiException":"MOVE Failed : ","Filename":"/新建 文本文档.txt","WebExceptionStatus":"ProtocolError","InnerException":"403 Forbidden","WebResponseCode":403,"HttpException":"Forbidden : Forbidden","HttpReferenceMessage":"Forbidden"}"} : \Device\HarddiskVolume3\Windows\explorer.exe(9472)

buse88 avatar Jun 14 '25 13:06 buse88

Webdav logs:

2025-06-14T22:31:12.472+0800 [34mINFO[0m user authorized {"username": "abcd", "remote_address": "192.168.1.2:13630"} 2025-06-14T22:31:12.472+0800 [35mDEBUG[0m allowed & method & path {"allowed": true, "method": "PROPFIND", "path": "/"} 2025-06-14T22:31:15.797+0800 [34mINFO[0m user authorized {"username": "abcd", "remote_address": "192.168.1.2:13642"} 2025-06-14T22:31:15.797+0800 [35mDEBUG[0m allowed & method & path {"allowed": true, "method": "PROPFIND", "path": "/"} 2025-06-14T22:31:16.044+0800 [34mINFO[0m user authorized {"username": "abcd", "remote_address": "192.168.1.2:13656"} 2025-06-14T22:31:16.044+0800 [35mDEBUG[0m allowed & method & path {"allowed": true, "method": "PROPFIND", "path": "/build/"} 2025-06-14T22:31:16.171+0800 [34mINFO[0m user authorized {"username": "abcd", "remote_address": "192.168.1.2:13662"} 2025-06-14T22:31:16.171+0800 [35mDEBUG[0m allowed & method & path {"allowed": true, "method": "PROPFIND", "path": "/webdav/"} 2025-06-14T22:31:16.308+0800 [34mINFO[0m user authorized {"username": "abcd", "remote_address": "192.168.1.2:13678"} 2025-06-14T22:31:16.308+0800 [35mDEBUG[0m allowed & method & path {"allowed": true, "method": "PROPFIND", "path": "/docker/"} 2025-06-14T22:31:16.441+0800 [34mINFO[0m user authorized {"username": "abcd", "remote_address": "192.168.1.2:13690"} 2025-06-14T22:31:16.441+0800 [35mDEBUG[0m allowed & method & path {"allowed": true, "method": "PROPFIND", "path": "/containerd/"} 2025-06-14T22:31:30.685+0800 [34mINFO[0m user authorized {"username": "abcd", "remote_address": "192.168.1.2:57284"} 2025-06-14T22:31:30.685+0800 [35mDEBUG[0m allowed & method & path {"allowed": true, "method": "PROPFIND", "path": "/"} 2025-06-14T22:31:30.723+0800 [34mINFO[0m user authorized {"username": "abcd", "remote_address": "192.168.1.2:57296"} 2025-06-14T22:31:30.724+0800 [35mDEBUG[0m allowed & method & path {"allowed": true, "method": "MOVE", "path": "/新建 文本文档.txt"} 2025-06-14T22:31:36.002+0800 [34mINFO[0m user authorized {"username": "abcd", "remote_address": "192.168.1.2:57304"} 2025-06-14T22:31:36.002+0800 [35mDEBUG[0m allowed & method & path {"allowed": true, "method": "PROPFIND", "path": "/webdav/"} 2025-06-14T22:31:52.022+0800 [34mINFO[0m user authorized {"username": "abcd", "remote_address": "192.168.1.2:28770"} 2025-06-14T22:31:52.022+0800 [35mDEBUG[0m allowed & method & path {"allowed": true, "method": "PROPFIND", "path": "/"} 2025-06-14T22:31:52.164+0800 [34mINFO[0m user authorized {"username": "abcd", "remote_address": "192.168.1.2:28778"} 2025-06-14T22:31:52.164+0800 [35mDEBUG[0m allowed & method & path {"allowed": true, "method": "PROPFIND", "path": "/webdav/"}

config.yaml:

address: 0.0.0.0 port: 13148 auth: true tls: false debug: true noSniff: true cert: cert.pem key: key.pem directory: /opt scope: . modify: true rules: [] users:

  • username: abcd password: abcd permissions: CRUD rules:
    • path: /opt permissions: CRUD scope: /opt/webdav

buse88 avatar Jun 14 '25 14:06 buse88

I got the same problem.

Versions:

  • webdav: 5.8.0
  • docker: 26.1.3

Operations:

✅ Create file ✅ Rename file ✅ Update file content ✅ Delete file ❌ Copy file ❌ Create folder ❌ Copy folder ❔ Rename folder ❔ Delete folder

Nginx config file:

server {
    server_name  webdav.example.com;

    #access_log  /data/nginx/logs/webdav.access.log;
    error_log /data/nginx/logs/webdav.error.log;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:6060;
        proxy_redirect off;

        # Ensure COPY and MOVE commands work. Change https://example.com to the
        # correct address where the WebDAV server will be deployed at.
        set $dest $http_destination;
        if ($http_destination ~ "^https://webdav.example.com/(?<path>(.+))") {
            set $dest /$path;
        }
        proxy_set_header Destination $dest;
    }

    listen 443 ssl; # managed by Certbot
}

config.yml

address: 0.0.0.0
port: 6060

tls: false
cert: cert.pem
key: key.pem

prefix: /

debug: false

noSniff: false

behindProxy: true

directory: /data

permissions: CRUD

rules: []

rulesBehavior: overwrite

log:
  format: console
  colors: true
  outputs:
  - stderr

cors:
  enabled: true
  credentials: true
  allowed_headers:
    - Depth
  allowed_hosts:
    - http://localhost:8080
  allowed_methods:
    - GET
  exposed_headers:
    - Content-Length
    - Content-Range

users:
  - username: test
    password: "{bcrypt}xxxxxxxxxx"
    scope: /data

hpyer avatar Aug 07 '25 07:08 hpyer

I find out the problem finally!!!

The tag latest of docker image hacdias/webdav is not the latest! 😂😂😂

See the picture below:

Image

v5.8.0 works well !

@buse88 兄弟,如果你也是docker装的,看下是不是也用了默认的 latest 标签,改成 v5 或者 v5.8.0 重新装就没问题了。

hpyer avatar Aug 07 '25 09:08 hpyer

It is, look: https://hub.docker.com/r/hacdias/webdav/tags

Maybe you need to pull it again?

hacdias avatar Aug 09 '25 05:08 hacdias

Docker mirror's problem. I pulled the latest version after change mirror. Thanks~

hpyer avatar Aug 09 '25 06:08 hpyer

I find out the problem finally!!! The tag latest of docker image hacdias/webdav is not the latest! 😂😂😂 See the picture below: Image v5.8.0 works well ! @buse88 兄弟,如果你也是docker装的,看下是不是也用了默认的 latest 标签,改成 v5 或者 v5.8.0 重新装就没问题了。

我不是用docker,我是直接可执行程序运行的,我用的是v5.8.0版

buse88 avatar Aug 13 '25 08:08 buse88

@buse88 那你再对比下我的nginx配置。特别是下面这句,域名后面的 / 不能少。

if ($http_destination ~ "^https://webdav.example.com/(?<path>(.+))") {
    set $dest /$path;
}

hpyer avatar Aug 13 '25 08:08 hpyer

@buse88 那你再对比下我的nginx配置。特别是下面这句,域名后面的 / 不能少。

if ($http_destination ~ "^https://webdav.example.com/(?<path>(.+))") {
    set $dest /$path;
}

https://github.com/hacdias/webdav/issues/231#issuecomment-2972758233这个是我的配置,我刚才试了下把 / 加上去也是不行

buse88 avatar Aug 13 '25 08:08 buse88

@buse88 那你再对比下我的nginx配置。特别是下面这句,域名后面的 / 不能少。

if ($http_destination ~ "^https://webdav.example.com/(?<path>(.+))") {
    set $dest /$path;
}

你是用哪个软件的呢,我使用的是RaiDrive,会不会是软件的原因

buse88 avatar Aug 13 '25 09:08 buse88

你是用哪个软件的呢,我使用的是RaiDrive,会不会是软件的原因

我就用的 windows 自带的 映射网络驱动器

Image

hpyer avatar Aug 13 '25 09:08 hpyer

你是用哪个软件的呢,我使用的是RaiDrive,会不会是软件的原因

我就用的 windows 自带的 映射网络驱动器

Image

我试了也是一样的情况,我还是试试docker看看

buse88 avatar Aug 13 '25 09:08 buse88

Closing this since there hasn't been an update over the last month. The reverse proxy issue (renaming, moving) is not specific to this repository, but to all WebDAV server implementations. To improve the Nginx example, please open a PR.

hacdias avatar Sep 11 '25 07:09 hacdias