WebDAV: 404 Not found

Hi all,

It drives me NUTS: Everything works with my nextCloud installation but when I try to access the files via WebDav I get 404 (Not found).

  • Google has no single match with my problem
  • The log files contain zero information (when doing the request there is nothing in the log except the 404 in the apache log)
  • Everything else works
  • Tried with nextCloud 10,11,12

Basically I am trying to open the URL https://my-server/cloud/remote.php/dav/files/my-username/ and all I get is a 404 Not found. Tried with many different WebDAV clients.

I also just re-extracted nextcloud-12.0.3.tar.bz2 from scratch and just copied my old config.php and a symlink to the data directory. Still not working.

So it must be the config somehow (which includes LDAP auth)


Nextcloud version (eg, 10.0.2): 12.0.3
Operating system and version (eg, Ubuntu 16.04): Debian 8.9
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.10 (Debian)
PHP version (eg, 5.6):5.6.30-0+deb8u1
Is this the first time you’ve seen this error?:

<?php
$CONFIG = array (
  'updatechecker' => false,
  'instanceid' => 'xme8whgfdlkjgsfd',
  'passwordsalt' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'secret' => 'p+AToFChe/xl4qs+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'trusted_domains' =>
  array (
    0 => '192.168.1.121',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'overwrite.cli.url' => 'http://192.168.1.121/cloud',
  'dbtype' => 'mysql',
  'version' => '12.0.3.3',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'owncloud',
  'dbpassword' => 'XXXXXXXXXXXXXXXX',
  'logtimezone' => 'UTC',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'overwritehost' => '127.0.0.1',
  'overwritewebroot' => '/cloud',
  'mail_from_address' => 'www-data',
  'mail_smtpmode' => 'php',
  'mail_domain' => 'XXXXXXX',
  'theme' => '',
  'loglevel' => 2,
  'maintenance' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'updater.secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
);

How(!) did you try to access webdav at https://my-server/edward/remote.php/dav/files/my-username/ ?

Aah sorry forgot to replace when scrambling the data for the post. My actual web root is “/edward” (guess why :wink: ) but for the post I replaced it with “/cloud”. Fixed my posting.

Ok I finally found the issue: Due to my LDAP setup, the usernames are internally UIDs.

Hence, the correct URL is not

https://server/cloud/remote.php/dav/files/username/

but instead:

https://server/cloud/remote.php/dav/files/1e75fef2-936f-102e-95c7-9351d84937/

Pretty crazy. No reference in the docs, no single google match. Am I the one person in the unverse who uses LDAP with WebDAV?

So now I got it working for myself which is fair but nextcloud does not write the actual WebDAV URL in the webinterface anywhere (which would be very useful btw - rather than generic and ambiguous links to the docs). So for “normal” users this is not practical. They don’t even know their internal username (it’s just the admin who sees it in the Users list).

What is the best way to tackle this?

Go To the Ldap Wizard -> Experts Tab -> Under internal Username set the ldap attribute you wish, for example “samaccountname”

You may also need: In the Login-Attributes Tab set “other login” to the same attribute.

Under Expert you can reset the Ldap Mapping.

From memory i think i remember, that a user that has already logged on at least once has his Directory set up, and it will not be changed. But try it out.

And: It IS VERY MUCH DOCUMENTED: https://docs.nextcloud.com/server/12/admin_manual/configuration_user/user_auth_ldap.html?highlight=ldap

rtfm :wink: