Connection with DAVdroid impossible - "405 error method not allowed"


My issue :
I had an DAVdroid account connecting to Nextcloud 12.0.4 (Or 12.0.3) and working fine.
I had to remove the account as I was moving domain (following the guide “moving-nextcloud-installation-from-one-domain-to-another”) but I can’t reconnect DAVdroid now. It now fails with error message (translated) “Configuration detection - No access to CalDAV or CardDAV services”. The DAVdroid debug shows “405 error - Method not allowed”.

The only thing I did appart from moving domain was playing with “Devices Token” but I am now using my main login and password for DAVdroid.

Web access, Nextcloud client on windows and Android works fine with main login
I did test on demo nextcloud com and it works, DAVdroid shows the next screen proposing to create an account on the phone

Any help is appreciated !


Nextcloud version : 12.0.4
Operating system and version : Linux based
Apache or nginx version : Unknown
PHP version : 7.0
Is this the first time you’ve seen this error?: Yes

Can you reliably replicate it? (If so, please outline steps): Yes
*Open DAVdroid
*click add an account
*type in the URL : [MY-DOMAIN]/remote.php
*login : main nextcloud login (user on web interface)
*click submit, after a while, the error message appears.

DAVdroid Version: 1.9.5-ose, uninstalled and reinstalled after reboot as per their FAQ.

The output of your Nextcloud log in Admin > Logging:

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

$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => '[MY-DOMAIN]',
  'datadirectory' => '/home/[USERNAME]/nextcloud/data',
  'overwrite.cli.url' => '[MY-DOMAIN]',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => '[DB]',
  'dbhost' => '[DB-HOST]',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '[DB-USER]',
  'dbpassword' => '[DB-PWD]',
  'logtimezone' => 'UTC',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 0,
  'overwriteprotocol' => 'https',
  '' => 'stable',
  'mail_domain' => '[EMAIL-DOMAIN]',
  'mail_from_address' => '[EMAIL-LOGIN]',
  'mail_smtpmode' => 'php',
  'mail_smtpauthtype' => 'LOGIN',

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

DAVDroid log :

AS part of the domain move, are you using a different web server? There’s a switch for apache somewhere that turns off DAV, as I recall.

It is the same server. I add both domains pointing to the same subfolder. I followed the tutorial there : Moving Nextcloud installation from one domain to another and simply edited the config.php file and DNS zone.

After much research it appears to be a peculiarity of my web host provider OVH and the way it handles cookies.
See issue 223. Patch adressing this already merged : 1328 and 797

Open nextcloud/lib/base.php and edit around line 534 to add Davdroid tot he incompatible user agents.

$incompatibleUserAgents = [
    			// OS X Finder
    			// DAVdroid

When associating DAVdroid with the Nextcloud account use the full url instead of the one provided by the Nextcloud android client :

source (in french) :

1 Like