This is the WebDAV interface. It can only be accessed by WebDAV clients such as the ownCloud desktop sync client


#1


I am having problems to access the Owncloud server WebDav through my browser. After I provide the address

http://IPADDRESS/owncloud/remote.php/dav/files/USERID/

I get the following message:

"This is the WebDAV interface. It can only be accessed by WebDAV clients such as the ownCloud desktop sync client."

Steps to reproduce

  1. Install Owncloud 10.0.7 on a Ubuntu 16.0.4 Server
  2. Connect a Oncloud Desktop Client with success
  3. Log into the account and try o access the webdav through browser

Expected behaviour

I should be able to access the folder through the webdav with no problems

Actual behaviour

I get the message that I can only access WebDAV through a client
Answer from a PHP page with CURL to access the folder

array (size=3)
'body' => string 'This is the WebDAV interface. It can only be accessed by WebDAV clients such as the ownCloud desktop sync client.' (length=113)
'statusCode' => int 200
'headers' =>
array (size=16)
'date' =>
array (size=1)
0 => string 'Fri, 09 Mar 2018 17:51:16 GMT' (length=29)
'server' =>
array (size=1)
0 => string 'Apache/2.4.18 (Ubuntu)' (length=22)
'set-cookie' =>
array (size=4)
0 => string 'oc9hihniqbzd=o9m8jlh6rr94qap0iv5rkfl8k3; path=/owncloud; HttpOnly' (length=65)
1 => string 'oc_sessionPassphrase=7ZRIXGLYPUJaAPgEY7hnCG29ICOq554RRh79hVx46MQfFtyu4a%2BQaELWehx3okdVHEGece2BaYnfQSdQJHEhqHIJI671Iftt2%2FYd34dY3010ywsOD6WABt5Yoa6f3jQ9; path=/owncloud; httponly' (length=179)
2 => string 'oc9hihniqbzd=udtindh4irlc2scekfsqnaqll5; path=/owncloud; HttpOnly' (length=65)
3 => string 'cookie_test=test; expires=Fri, 09-Mar-2018 18:51:17 GMT; Max-Age=3600' (length=69)
'expires' =>
array (size=1)
0 => string 'Thu, 19 Nov 1981 08:52:00 GMT' (length=29)
'cache-control' =>
array (size=1)
0 => string 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0' (length=62)
'pragma' =>
array (size=1)
0 => string 'no-cache' (length=8)
'content-security-policy' =>
array (size=1)
0 => string 'default-src 'none';' (length=19)
'vary' =>
array (size=1)
0 => string 'Accept-Encoding' (length=15)
'x-content-type-options' =>
array (size=1)
0 => string 'nosniff' (length=7)
'x-xss-protection' =>
array (size=1)
0 => string '1; mode=block' (length=13)
'x-robots-tag' =>
array (size=1)
0 => string 'none' (length=4)
'x-frame-options' =>
array (size=1)
0 => string 'SAMEORIGIN' (length=10)
'x-download-options' =>
array (size=1)
0 => string 'noopen' (length=6)
'x-permitted-cross-domain-policies' =>
array (size=1)
0 => string 'none' (length=4)
'content-length' =>
array (size=1)
0 => string '113' (length=3)
'content-type' =>
array (size=1)
0 => string 'text/html; charset=UTF-8' (length=24)

Server configuration

Operating system:
Ubuntu 16.0.4

Web server:
Apache 2

Database:
MySQL

PHP version:
5

ownCloud version: (see ownCloud admin page)
10.0.7

Updated from an older ownCloud or fresh install:
Fresh install

Where did you install ownCloud from:
PuTTY

Signing status (ownCloud 9.0 and above):
No errors have been found

The content of config/config.php:
<?php
$CONFIG = array (
'instanceid' => 'oc9hihniqbzd',
'passwordsalt' => '***',
'secret' => '***',
'trusted_domains' =>
array (
0 => '54.38.164.130',
1 => 'localhost',
),
'datadirectory' => '/var/www/html/owncloud/data',
'overwrite.cli.url' => 'http://54.38.164.130/owncloud',
'dbtype' => 'mysql',
'version' => '10.0.7.2',
'dbname' => 'owncloud',
'dbhost' => 'localhost',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => '***',
'dbpassword' => '***',
'logtimezone' => 'UTC',
'installed' => true,
'check_for_working_webdav' => true,
'check_for_working_htaccess' => true,
'log_type' => 'owncloud',
'logfile' => '/var/log/owncloud.log',
'loglevel' => 2,
);

List of activated apps:
Enabled:
- comments: 0.3.0
- configreport: 0.1.1
- dav: 0.3.2
- federatedfilesharing: 0.3.1
- federation: 0.1.0
- files: 1.5.1
- files_external: 0.7.1
- files_sharing: 0.10.1
- files_trashbin: 0.9.1
- files_versions: 1.3.0
- files_videoplayer: 0.9.8
- firstrunwizard: 1.1
- market: 0.2.3
- notifications: 0.3.2
- provisioning_api: 0.5.0
- systemtags: 0.3.0
- templateeditor: 0.2
- updatenotification: 0.2.1
Disabled:
- encryption
- external
- theme-example
- user_external

Are you using external storage, if yes which one: local/smb/sftp/...
NO

Are you using encryption: yes/no
NO

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
NO

Client configuration

Browser:
Chrome

Operating system:
Windows 7

Logs

Web server error log

ownCloud log (data/owncloud.log)

Browser log


#2

I think this message is showing you the reason why you're facing this issue. A browser is probably no WebDAV client, curl probably isn't one as well if not correctly used.


#3

I thnik I did right because when I activated the debug function to track the problem, I was able to read correctly from webdav... but with the side effect that I was not able to download any file, not even from the owncloud official pages.

When I removed the debug function from the config.php I lost the access to the folder contents and got back the access to the files.

One another thing that I noticed from this 10.0.7 version is that the link to download a file was kept like the version 8:

http://SERVER/owncloud/remote.php/webdav/FOLDER/FILE

but to access the folder the link is different:

http://SERVER/owncloud/remote.php/dav/files/USER/FOLDER


#4

Found this message on trying to access a folder from webdav

{"reqId":"GtGPsVYN6M5OzY0crDvv","level":0,"time":"2018-03-12T16:42:32+00:00","remoteAddr":"186.251.246.190","user":"--","app":"webdav","method":"GET","url":"\/owncloud\/remote.php\/dav\/files\/automproc\/apice\/","message":"Exception: {\"Message\":\"HTTP\\/1.1 401 No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured\",\"Exception\":\"Sabre\\DAV\\Exception\\NotAuthenticated\",\"Code\":0,\"Trace\":\"#0 [internal function]: Sabre\\DAV\\Auth\\Plugin->beforeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#1 \\/var\\/www\\/html\\/owncloud\\/lib\\/composer\\/sabre\\/event\\/lib\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#2 \\/var\\/www\\/html\\/owncloud\\/lib\\/composer\\/sabre\\/dav\\/lib\\/DAV\\/Server.php(466): Sabre\\Event\\EventEmitter->emit('beforeMethod', Array)\n#3 \\/var\\/www\\/html\\/owncloud\\/lib\\/composer\\/sabre\\/dav\\/lib\\/DAV\\/Server.php(254): Sabre\\DAV\\Server->invokeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#4 \\/var\\/www\\/html\\/owncloud\\/apps\\/dav\\/lib\\/Server.php(263): Sabre\\DAV\\Server->exec()\n#5 \\/var\\/www\\/html\\/owncloud\\/apps\\/dav\\/appinfo\\/v2\\/remote.php(31): OCA\\DAV\\Server->exec()\n#6 \\/var\\/www\\/html\\/owncloud\\/remote.php(165): require_once('\\/var\\/www\\/html\\/o...')\n#7 {main}\",\"File\":\"\\/var\\/www\\/html\\/owncloud\\/lib\\/composer\\/sabre\\/dav\\/lib\\/DAV\\/Auth\\/Plugin.php\",\"Line\":168,\"User\":false}"}


#5

I think the posted logentry shows again some info / pointers whats missing in your request:


#6

The question is: what is missing? I've checked all my installation and found nothing so far.


#7

To access ownCloud via WebDav you need to use a WebDav client - e.g. cadaver.

The reason you see something in the browser in debug mode is that we add a simple but powerfull development tool which acts on top of webdav.

Maybe you explain what you are trying to do and we can find a solution.


#8

I have a PHP system that uses Owncloud as a storage device. I use the system to upload/download files e show folders. So far I was using owncloud 8 at windows. Now I am trying to setup this cloud on linux/ubuntu using owncloud 10.0.7. This is my first try on using Linux. I`ve followed a guide to install owncloud and everything went fine. including setting up an owncloud client to sync files. The problem is when I use CURL at PHP to retrieve the contents of a folder. I get this message that " It can only be accessed by WebDAV clients such as the ownCloud desktop sync client." and when I set the debug on, it goes away.


#9

Then use the sabredav library which ships a WebDav client for php. This way you can talk proper WebDav.

see http://sabre.io/dav/davclient/


#10

I am using the sabredav library


#11

But in all the messages above you are talking about curl and browser - this does not fit together.


#12

Curl gives me the same result as the browser. Using the browser to test the sabredav is better than the code. First I thought that was something wrong in the code that works with owncloud 8 and it was not working with owncloud 10, then I found out that the problem its not with the code but with the owncloud 10 server.


#13

FYI: using curl to download a file via old and new webdav endpoint - maybe this helps ...
Listing folder content requires a PROPFIND request - best to be executed with a WebDav client or library


#14

I am away from the desktop I use to code. Tomorrow I'll post the code used for owncloud 8 (that works) and with owncloud 10 (only works in debug mode). I do not believe the problem is with the code. I believe I missed something on the server install/config.


#15

Here it's the code that works on accessing a folder from owncloud8

include_once 'vendor/autoload.php';
$settings = array(
	'baseUri' => 'http://'.$GLOBALS['server_owncloud'].'/owncloud/remote.php/webdav/'.$url,
	'userName' => $GLOBALS['user_owncloud'],
	'password' => $GLOBALS['pass_owncloud'],
);               
ini_set('memory_limit', '-1');
$client1 = new Sabre\DAV\Client($settings);
$response = $client1->request('GET');

The owncloud10 code is slightly different only on the baseUri:

include_once 'vendor/autoload.php';
$settings = array(
	'baseUri' => 'http://'.$GLOBALS['server_owncloud'].'/owncloud/remote.php/dav/files/'.$GLOBALS['user_owncloud'].'/'.$url,
	'userName' => $GLOBALS['user_owncloud'],
	'password' => $GLOBALS['pass_owncloud'],
);               
ini_set('memory_limit', '-1');
$client1 = new Sabre\DAV\Client($settings);
$response = $client1->request('GET');

when I run the owncloud10 code without debug=true I get this $response:

array (size=3)
'body' => string 'This is the WebDAV interface. It can only be accessed by WebDAV clients such as the ownCloud desktop sync client.' (length=113)
'statusCode' => int 200
'headers' =>
array (size=16)
'date' =>
array (size=1)
0 => string 'Tue, 13 Mar 2018 11:24:37 GMT' (length=29)
'server' =>
array (size=1)
0 => string 'Apache/2.4.18 (Ubuntu)' (length=22)
'set-cookie' =>
array (size=4)
0 => string 'oc9hihniqbzd=0re20h8gq2aktoe0jsp47ahsd1; path=/owncloud; HttpOnly' (length=65)
1 => string 'oc_sessionPassphrase=c4agO0du2MGSKI8oYIAWQJxs8Nx2GFCwvu13X%2BJjpQMGT%2Fl8TnVRHVXH6EWebQI8M4sRhXT4A7G6%2F0yKMQxwzpaSEZRvRq39JlhCoITxwtaMgMauoHmwEZn2RJiZBjt5; path=/owncloud; httponly' (length=181)
2 => string 'oc9hihniqbzd=tcjbptd019op6o486d88mbfok0; path=/owncloud; HttpOnly' (length=65)
3 => string 'cookie_test=test; expires=Tue, 13-Mar-2018 12:24:37 GMT; Max-Age=3600' (length=69)
'expires' =>
array (size=1)
0 => string 'Thu, 19 Nov 1981 08:52:00 GMT' (length=29)
'cache-control' =>
array (size=1)
0 => string 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0' (length=62)
'pragma' =>
array (size=1)
0 => string 'no-cache' (length=8)
'content-security-policy' =>
array (size=1)
0 => string 'default-src 'none';' (length=19)
'vary' =>
array (size=1)
0 => string 'Accept-Encoding' (length=15)
'x-content-type-options' =>
array (size=1)
0 => string 'nosniff' (length=7)
'x-xss-protection' =>
array (size=1)
0 => string '1; mode=block' (length=13)
'x-robots-tag' =>
array (size=1)
0 => string 'none' (length=4)
'x-frame-options' =>
array (size=1)
0 => string 'SAMEORIGIN' (length=10)
'x-download-options' =>
array (size=1)
0 => string 'noopen' (length=6)
'x-permitted-cross-domain-policies' =>
array (size=1)
0 => string 'none' (length=4)
'content-length' =>
array (size=1)
0 => string '113' (length=3)
'content-type' =>
array (size=1)
0 => string 'text/html; charset=UTF-8' (length=24)

when I set debug=true at the config.php from owncloud10 I get this response:

array (size=3)
'body' => string '


... (REMOVED FOR SECURITY REASONS)

Actions



Create new folder



Name:




Upload file



Name (optional):

File:




Generated by SabreDAV (c)2007-2016 http://sabre.io/

' (length=10450)
'statusCode' => int 200
'headers' =>
array (size=16)
'date' =>
array (size=1)
0 => string 'Tue, 13 Mar 2018 11:27:27 GMT' (length=29)
'server' =>
array (size=1)
0 => string 'Apache/2.4.18 (Ubuntu)' (length=22)
'set-cookie' =>
array (size=4)
0 => string 'oc9hihniqbzd=g3rosfuu0vnpl44p4i5mr9b4r1; path=/owncloud; HttpOnly' (length=65)
1 => string 'oc_sessionPassphrase=8AiyfNx%2BPSEB16UItyikEBtciASwBacREyY7fkY9jc5%2BYxns%2BHqzQg%2FheuYcCjUp3oxMK89iquR11HeF3bpLG%2BgJxnnHjJkAJwsICgrrTOqah3N1yXdskUDWrjF1xv3t; path=/owncloud; httponly' (length=185)
2 => string 'oc9hihniqbzd=imusj04cfkgc8rsde6auoqtjh7; path=/owncloud; HttpOnly' (length=65)
3 => string 'cookie_test=test; expires=Tue, 13-Mar-2018 12:27:27 GMT; Max-Age=3600' (length=69)
'expires' =>
array (size=1)
0 => string 'Thu, 19 Nov 1981 08:52:00 GMT' (length=29)
'cache-control' =>
array (size=1)
0 => string 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0' (length=62)
'pragma' =>
array (size=1)
0 => string 'no-cache' (length=8)
'content-security-policy' =>
array (size=1)
0 => string 'default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';' (length=70)
'vary' =>
array (size=1)
0 => string 'Accept-Encoding' (length=15)
'x-content-type-options' =>
array (size=1)
0 => string 'nosniff' (length=7)
'x-xss-protection' =>
array (size=1)
0 => string '1; mode=block' (length=13)
'x-robots-tag' =>
array (size=1)
0 => string 'none' (length=4)
'x-frame-options' =>
array (size=1)
0 => string 'SAMEORIGIN' (length=10)
'x-download-options' =>
array (size=1)
0 => string 'noopen' (length=6)
'x-permitted-cross-domain-policies' =>
array (size=1)
0 => string 'none' (length=4)
'transfer-encoding' =>
array (size=1)
0 => string 'chunked' (length=7)
'content-type' =>
array (size=1)
0 => string 'text/html; charset=utf-8' (length=24)

#16

Making progress. I was able to access the folder using propfind:

Now I am trying to put this code on PHP but got nothing as result:

include_once 'vendor/autoload.php';
$url='http://cloud.apiceflow.com.br/owncloud/remote.php/dav/files/'.$GLOBALS['user_owncloud'].'/apice/';
$settings = array(
        'baseUri' => $url,
        'userName' => $GLOBALS['user_owncloud'],
        'password' => $GLOBALS['pass_owncloud'],
    );

$client = new Sabre\DAV\Client($settings);
$response = $client->propfind($url, array(
    '{DAV:}displayname',
    '{DAV:}getcontentlength',
));
var_dump($response);

#17

I think I've found the solution:

//https://github.com/owncloud/core/issues/15902
include_once 'vendor/autoload.php';
$url='http://cloud.apiceflow.com.br/owncloud/remote.php/webdav/apice/7WORLD-900019/Documentos/';
$settings = array(
        'baseUri' => $url,
        'userName' => $GLOBALS['user_owncloud'],
        'password' => $GLOBALS['pass_owncloud'],
    );

$client = new Sabre\DAV\Client($settings);
$response = $client->propFind($url, array(
    '{DAV:}displayname',
    '{DAV:}getlastmodified',
    '{DAV:}getcontenttype',
    '{DAV:}getcontentlength',
),1);
var_dump($response);