Remote webdav connection from synology dsm to nextcloud

Nextcloud version (eg, 12.0.2): 13.0.7
Operating system and version (eg, Ubuntu 17.04): Debian Jessie
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.10
PHP version (eg, 7.1): 5.6.38

The issue you are facing:

I try to connect from synology dsm filemanager to nextcloud via webdavs and got the following error message from synology: “Connection refused by server”. I do not have any issues if i connect via nautilus filemanager or any other client via webdav.

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Open remote connection setup wizard in dsm
  2. Input all necessary webdav login data from your nextcloud
  3. Click Apply

The output of your Nextcloud log in Admin > Logging:

{"reqId":"of6xr4zpbsab60ugFd8K","level":1,"time":"2018-11-03T13:02:06+00:00","remoteAddr":"xxxxx:cfc","user":"--","app":"admin_audit","method":"GET","url":"\/\/remote.php\/webdav\/","message":"Login attempt: \"USER\"","userAgent":"--","version":"13.0.7.2"}
{"reqId":"of6xr4zpbsab60ugFd8K","level":1,"time":"2018-11-03T13:02:07+00:00","remoteAddr":"xxxxx::cfc","user":"USER","app":"admin_audit","method":"GET","url":"\/\/remote.php\/webdav\/","message":"Login successful: \"USER\"","userAgent":"--","version":"13.0.7.2"}
{"reqId":"5ikS5Swnfyn6YRUUPk9L","level":0,"time":"2018-11-03T13:02:08+00:00","remoteAddr":"xxxxx::cfc","user":"--","app":"webdav","method":"PROPFIND","url":"\/\/remote.php\/webdav","message":"Exception: {\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotAuthenticated\",\"Message\":\"No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured\",\"Code\":0,\"Trace\":\"#0 [internal function]: Sabre\\\\DAV\\\\Auth\\\\Plugin->beforeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/var\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#2 \\\/var\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(466): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#3 \\\/var\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(80): Sabre\\\\DAV\\\\Server->exec()\\n#5 \\\/var\\\/www\\\/nextcloud\\\/remote.php(164): require_once('\\\/var\\\/www\\\/nextcl...')\\n#6 {main}\",\"File\":\"\\\/var\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Auth\\\/Plugin.php\",\"Line\":168}","userAgent":"gvfs\/1.21.1","version":"13.0.7.2"}
{"reqId":"OrWK1nUfv7t0z4Z3a73t","level":1,"time":"2018-11-03T13:02:08+00:00","remoteAddr":"xxxxx::cfc","user":"--","app":"admin_audit","method":"PROPFIND","url":"\/\/remote.php\/webdav","message":"Login attempt: \"USER\"","userAgent":"gvfs\/1.21.1","version":"13.0.7.2"}
{"reqId":"OrWK1nUfv7t0z4Z3a73t","level":1,"time":"2018-11-03T13:02:08+00:00","remoteAddr":"xxxxx::cfc","user":"USER","app":"admin_audit","method":"PROPFIND","url":"\/\/remote.php\/webdav","message":"Login successful: \"USER\"","userAgent":"gvfs\/1.21.1","version":"13.0.7.2"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'xxxx',
  'passwordsalt' => 'xxxxx',
  'secret' => 'xxxxx',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'domain.tlfd',
  ),
  'datadirectory' => '/var/nextcloud-data',
  'overwrite.cli.url' => 'https://domain.tld',
  'dbtype' => 'mysql',
  'version' => '13.0.7.2',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_xxxx',
  'dbpassword' => 'xxxxx',
  'logtimezone' => 'UTC',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_smtpmode' => 'sendmail',
  'mail_from_address' => 'cloud',
  'mail_domain' => 'xxxxx',
  'defaultapp' => 'calendar',
  'logfile' => '/var/nextcloud-data/nextcloud.log',
  'loglevel' => 2,
  'maintenance' => false,
  'updater.release.channel' => 'stable',
  'theme' => '',
  'appstoreenabled' => true,
);

The output of your Apache/nginx/system log in /var/log/____:


XXX::cfc - USER [03/Nov/2018:14:12:35 +0100] "GET //remote.php/webdav/ HTTP/1.1" 200 5215 "-" "-"
XXX:e478 - - [03/Nov/2018:14:12:36 +0100] "GET /remote.php/webdav/ HTTP/1.1" 401 1834 "-" "-"
XXXe478 - - [03/Nov/2018:14:12:29 +0100] "GET /index.php/apps/logreader/poll?lastReqId=CyrZRm3eilkNCjI9mvaX HTTP/1.1" 200 3476 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0"
2a00:61e0:4046:5500:6c5a:f63c:8a94:e478 - USER [03/Nov/2018:14:12:36 +0100] "GET /remote.php/webdav/ HTTP/1.1" 200 1557 "-" "-"
XXX::cfc - - [03/Nov/2018:14:12:37 +0100] "OPTIONS //remote.php/webdav HTTP/1.1" 200 5289 "-" "gvfs/1.21.1"
XXX::cfc - - [03/Nov/2018:14:12:37 +0100] "PROPFIND //remote.php/webdav HTTP/1.1" 401 1166 "-" "gvfs/1.21.1"
XXX::cfc - USER [03/Nov/2018:14:12:37 +0100] "PROPFIND //remote.php/webdav HTTP/1.1" 207 1374 "-" "gvfs/1.21.1"
XXX:e478 - - [03/Nov/2018:14:12:38 +0100] "GET /remote.php/webdav/ HTTP/1.1" 401 1834 "-" "-"
XXX:e478 - USER [03/Nov/2018:14:12:38 +0100] "GET /remote.php/webdav/ HTTP/1.1" 200 1559 "-" "-"
XXX:e478 - - [03/Nov/2018:14:12:36 +0100] "GET /index.php/apps/logreader/poll?lastReqId=BPTTowdAO3tL2zOv2CDM HTTP/1.1" 200 5419 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0"
XXX:e478 - - [03/Nov/2018:14:12:39 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 952 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0"


+1 for the same issue.

If not an erroneous error message from the Synology, it sounds like a configuration issue on your part or implementation issue on the Synology side.

There’s not really much that can be done from the Nextcloud of things if the connection isn’t even getting to it.

If you have the capability/knowledge to run a packet sniffer like tcpdump/wireshark on the NC side or on the path in between the two devices that would tell you with more certainty what is going on.