1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

nginxのWebDAVでMOVE時に一部クライアントで動かない対策

Posted at

nginxはWebDAVの仕様通りに実装されているのだが、結果として動かなくなっているので修正する

修正箇所

以下を削除してビルドする
https://trac.nginx.org/nginx/browser/nginx/src/http/modules/ngx_http_dav_module.c#L621

    if ((r->uri.data[r->uri.len - 1] == '/' && *(last - 1) != '/')
        || (r->uri.data[r->uri.len - 1] != '/' && *(last - 1) == '/'))
    {
         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                       "both URI \"%V\" and \"Destination\" URI \"%V\" "
                       "should be either collections or non-collections",
                       &r->uri, &dest->value);
         return NGX_HTTP_CONFLICT;
    }

一応ビルドオプション

./configure --prefix=/usr/local --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 --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_spdy_module --with-http_dav_module --add-module=./nginx-dav-ext-module --with-debug

事象

MacのCyberduckがWebDAVのMOVEメソッド時にRequestのDestination項目に移動先がディレクトリにもかかわらず/を付けて送信しないため、WebDAVの仕様通りに実装してるっぽいnginxのwebdavモジュールがNG判定してくれるのが原因。

MOVE /test2/ HTTP/1.1
Destination: http://hoge.com/test/test2
Overwrite: T
Host: hoge.com
Connection: Keep-Alive
User-Agent: Cyberduck/4.7.2.18004 (Mac OS X/10.11) (x86_64)
Accept-Encoding: gzip,deflate

この処理除いても、それ以降にディレクトリかどうかとかチェックしてるので大丈夫でしょう。
実体参照されるまでわからなくなるのでパフォーマンスは低下するかも。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?