Opened 4 years ago

Closed 4 years ago

#1108 closed defect (invalid)

Module ngx_http_dav_module MOVE and COPY method not working

Reported by: trupf@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.10.x
Keywords: Cc:
uname -a: Linux nas 3.16.7-ckt9.20150617-lsproduo #3 Thu Jun 18 00:44:54 CEST 2015 armv5tel GNU/Linux
nginx -V: nginx version: nginx/1.10.1
built with OpenSSL 1.0.2i 22 Sep 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-Nkiytp/nginx-1.10.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=/build/nginx-Nkiytp/nginx-1.10.1/debian/modules/nginx-auth-pam --add-module=/build/nginx-Nkiytp/nginx-1.10.1/debian/modules/nginx-dav-ext-module --add-dynamic-module=/build/nginx-Nkiytp/nginx-1.10.1/debian/modules/nginx-echo --add-dynamic-module=/build/nginx-Nkiytp/nginx-1.10.1/debian/modules/nginx-upstream-fair --add-dynamic-module=/build/nginx-Nkiytp/nginx-1.10.1/debian/modules/ngx_http_substitutions_filter_module

Description

GET, PUT MKCOL and DELETE do work as intended, but not MOVE (I don't know about COPY). I have tried with different clients (Konqueror in linux, Total Commander under Win7 and FolderSync under Android. Neither did work. I don't think it has to do with the trailing slash issue (see below) is it is not working for files and not for directories. MKCOL does work with a rewrite adding the trailing slash in the server block.

relevant config parts

location ~* /webdav($|/) {

root /mnt/data/www/;
client_body_temp_path /mnt/data/srv;
client_max_body_size 4000M; # set maximum upload size

# NGINX WebDAV requires trailing slashes on directories, yet certain
# common WebDAV clients don't support them. Do rewrites to fix it
# sollte hier funktionieren, geht aber nicht, daher im Server Block.
# if ($request_method = MKCOL) { rewrite (.*[/])$ $1/ break; }
# if (-d $request_filename) { rewrite (.*[/])$ $1/ break; }

dav_methods off;
dav_ext_methods PROPFIND OPTIONS;
create_full_put_path on;
dav_access user:rw group:rw all:r;
auth_basic "WebDav Access";
min_delete_depth 3;
auth_basic_user_file /etc/nginx/.htpasswd;
autoindex on;
autoindex_exact_size on;
charset UTF-8;

location ~ /webdav/Dokumente($|/)(.*)$ {

alias /mnt/data/ocdata/$remote_user/$2;
dav_methods PUT DELETE MKCOL COPY MOVE;

# dav_methods PUT DELETE MKCOL;

dav_ext_methods PROPFIND OPTIONS;
min_delete_depth 3;
access_log off;

}

}

As written from other users: could you also fix the issue with missing trailing '/' for directories (see here for example:
http://www.agoragames.com/blog/2009/03/20/webdav-nginx-play-nice/ or here https://github.com/arut/nginx-dav-ext-module/issues/20)

Change History (2)

comment:1 by trupf@…, 4 years ago

I found the reason: It is the alias directive. It is working with the root directive. A rewrite will create the same problem as the alias. I guess this due to the path in the XML file gets not modified the same way as the alias / rewrite it are doing (for requests which send a XML file). Would be helpful, if that would be mentioned in the documentation. Or better you fix it so that the alias/rewrite will also be applied to the path in the XML document.

Although it is possible to add the missing trailing slash for directories with rewrites, the same problem applies for the XML document here, as it will not be added there.

comment:2 by Maxim Dounin, 4 years ago

Resolution: invalid
Status: newclosed

The problem is that your alias specifies full path to a document. This makes it impossible for MOVE to work as it uses two different URIs, and due to alias both map to the same file.

Note: See TracTickets for help on using tickets.