N
N
Nikita Kolosov2016-11-25 10:45:44
Nginx
Nikita Kolosov, 2016-11-25 10:45:44

How to use the COPY method in WebDAV (nginx)?

There is the following problem:
When trying to copy the /from.png file using cURL to another directory using the COPY method, nginx swears.
nginx config:

location ~ ^/path/.+\.png {
   root  /mnt/path/to/;
   client_max_body_size 2m;
   dav_methods          PUT DELETE COPY;
   create_full_put_path on;
   dav_access           group:rw all:r;
}

Here is a request sent by curl (output with the verbose parameter)
> COPY /path/dir/file.png HTTP/1.1
Host: localhost
Accept: */*
Destination: http://localhost/path/dir2/file2.png

< HTTP/1.1 500 Internal Server Error
< Server: nginx/1.10.0 (Ubuntu)
< Date: Fri, 25 Nov 2016 07:38:53 GMT
< Content-Type: text/html
< Content-Length: 202
< Connection: close
< 
* Closing connection 0

Error in log:
2016/11/25 14:38:53 [crit] 12205#12205: *626 open() "/mnt/path/to/path/dir2/file2.png" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "COPY /path/dir/file.png HTTP/1.1", host: "localhost"

The directory dir2 does not exist, is there any way to force nginx to create it and copy the file there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-11-28
@prolis

Apply DAV PUT Method
curl -T '/path/to/local/file.txt' ' example.com/test '

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question