Davdroid / DavX^5 not working with newer Nextclouds

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2):15.0.3
Operating system and version (eg, Ubuntu 17.04): Alpine Linux on Docker

The issue you are facing:
Davdroid aka DavX^5 cannot login to the caldav service. It complains about not being able to authenticate and a missing Authority: Bearer header. It worked fine in earlier versions.

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

Steps to replicate it:

  1. Install the wonderfall docker image.
  2. Setup a docker-compose similar to mine
  3. Try to add the caldav service to davdroid/davx^5

The output of your Nextcloud log in Admin > Logging:

[core] Warning: Login failed: 'username' (Remote IP: 'ip')
from ip at 2019-02-08T06:15:24+01:00

My docker-compose for nextcloud:

  nextcloud:
    image: wonderfall/nextcloud:latest
    container_name: nextcloud
    network_mode: bridge
    environment:
      - UID=1000
      - GID=1000
      - UPLOAD_MAX_SIZE=10G
      - APC_SHM_SIZE=128M
      - OPCACHE_MEM_SIZE=128
      - MEMORY_LIMIT=512M
      - CRON_PERIOD=15m
      - DB_TYPE=mysql
      - DB_NAME=nextcloud
      - DB_USER=nextcloud
      - DB_HOST=mariadb
    depends_on:
      - mariadb
    links:
      - mariadb
      - mail
    volumes:
      - nextcloud-data:/data
      - nextcloud-config:/config
      - nextcloud-apps:/nextcloud/apps2
      - nextcloud-themes:/nextcloud/themes
    labels:
      - "traefik.enable=true"
      - "traefik.port=8888"
      - "traefik.frontend.rule=Host:nextcloud.domain.tld"
      - "traefik.frontend.headers.STSSeconds=31536000"
      - "traefik.frontend.headers.referrerPolicy=strict-origin"
      - "traefik.frontend.redirect.permanent=true"
      - "traefik.frontend.redirect.regex=https://(.*)/.well-known/(card|cal)dav"
      - "traefik.frontend.redirect.replacement=https://$$1/remote.php/dav/"

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

<?php
$CONFIG = array (
  'datadirectory' => '/data',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/nextcloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/nextcloud/apps2',
      'url' => '/apps2',
      'writable' => true,
    ),
  ),
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => ',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.domain.tld',
  ),
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'overwrite.cli.url' => 'https://nextcloud.domain.tld',
  'config_is_read_only' => true,
  'dbtype' => 'mysql',
  'version' => '15.0.3.0',
  'dbname' => 'nextcloud',
  'dbhost' => 'mariadb',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mail_from_address' => 'administrator',
  'logtimezone' => '',
  'logdateformat' => 'Y-m-d H:i:s',
  'dbuser' => 'oc_admin',
  'dbpassword' => 'password',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'maintenance' => false,
  'loglevel' => 2,
  'updater.release.channel' => 'stable',
  'theme' => '',
  'trusted_proxies' => 
  array (
    0 => 'IPnet',
  ),
  'overwriteprotocol' => 'https',
  'mail_domain' => 'domain.tld',
  'mail_smtphost' => '',
  'mail_smtpport' => '25',
);

And the nginx config file:

server {
        listen 8888;
        root /nextcloud;
        
        fastcgi_buffers 64 4K;

        # https://docs.nextcloud.com/server/14/admin_manual/configuration_server/harden_server.html?highlight=security#enable-http-strict-transport-security
        add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload";
        # https://docs.nextcloud.com/server/14/admin_manual/configuration_server/harden_server.html?highlight=security#serve-security-related-headers-by-the-web-server
        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";
        add_header X-Robots-Tag none;
        add_header X-Download-Options noopen;
        add_header X-Permitted-Cross-Domain-Policies none;
        add_header Referrer-Policy "no-referrer" always;

        location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
        }

        location = /.well-known/carddav {
            return 301 $scheme://$host/remote.php/dav;
        }

        location = /.well-known/caldav {
            return 301 $scheme://$host/remote.php/dav;
        }

        location / {
            rewrite ^ /index.php$uri;
        }

        location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
            deny all;
        }

        location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
            deny all;
        }

        location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
            include /nginx/conf/fastcgi_params;
            fastcgi_split_path_info ^(.+\.php)(/.*)$;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param modHeadersAvailable true;
            fastcgi_param front_controller_active true;
            fastcgi_pass unix:/php/run/php-fpm.sock;
            fastcgi_intercept_errors on;
            fastcgi_request_buffering off;
            fastcgi_read_timeout 1200;
        }

        location ~ ^/(?:updater|ocs-provider)(?:$|/) {
            try_files $uri/ =404;
            index index.php;
        }

        location ~* \.(?:css|js|woff2?|svg|gif)$ {
            try_files $uri /index.php$uri$is_args$args;
            add_header Cache-Control "public, max-age=7200";
            add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
            add_header X-Frame-Options "SAMEORIGIN";
            add_header X-Content-Type-Options nosniff;
            add_header X-XSS-Protection "1; mode=block";
            add_header X-Robots-Tag none;
            add_header X-Download-Options noopen;
            add_header X-Permitted-Cross-Domain-Policies none;
            access_log off;
        }

        location ~* \.(?:png|html|ttf|ico|jpg|jpeg)$ {
            try_files $uri /index.php$uri$is_args$args;
            access_log off;
}

Hmm works perfectly fine here until v15.0.4 now.

Did you try to purge and setup DAVx^5 from scratch?

Otherwise it’s a docker specific issue.

Yes, this was on a new install of DAVx^5. Earlier setups worked fine.

Ok, nvm apparently 15.0.4 has a fix for that. With latest version it seems to work fine.