.well-known/caldav warning

Nextcloud version (eg, 12.0.2): 18.0.3
Operating system and version (eg, Ubuntu 17.04): Raspbian GNU/Linux 10 (buster)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.38 (Raspbian)
PHP version (eg, 7.1): PHP 7.3.14-1~deb10u1 (cli)

The issue you are facing:

  • Your web server is not properly set up to resolve “/.well-known/caldav”. _
  • Your web server is not properly set up to resolve “/.well-known/carddav”.

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

Steps to replicate it:

  1. Call overview in NCP’s Settings

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

<?php
$CONFIG = array (
  'passwordsalt' => 'XXX',
  'secret' => 'XXX',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    11 => '2a02:908:212:ed40:8618:a611:c43f:8d2c',
    1 => '192.168.0.87',
    5 => 'nextcloudpi.local',
    7 => 'nextcloudpi',
    8 => 'nextcloudpi.lan',
    20 => 'example.com',
    21 => '192.168.0.87',
  ),
  'datadirectory' => '/media/ssd_nextcloud/nextcloud/ncdata/',
  'dbtype' => 'mysql',
  'version' => '18.0.3.0',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'ncadmin',
  'dbpassword' => 'XXX',
  'installed' => true,
  'instanceid' => 'oc6cnssj6shs',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
	'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'XXX',
  'dbpassword' => 'XXX',
  'installed' => true,
  'instanceid' => 'oc6cnssj6shs',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>                                                                                                                             array (                                                                                                                                  'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => 'XXX',
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'XXX',
  'mail_domain' => 'XXX',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'tempdirectory' => '/media/ssd_nextcloud/nextcloud/ncdata/tmp',
  'logfile' => '/media/ssd_nextcloud/nextcloud/ncdata/nextcloud.log',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_smtphost' => 'XXX',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'XXX',
  'mail_smtppassword' => 'XXX',
  'updater.release.channel' => 'stable',
  'theme' => '',
  'loglevel' => 2,
);

My Nextcloud instance is installed unter /var/www/nextcloud. Also SSL encryption via letsencrypt and certbot.
I found this hints (https://docs.nextcloud.com/server/18/admin_manual/issues/general_troubleshooting.html#service-discovery) but I don’t know which .htaccess file I should edit (there are several in the folders like /var/www or /var/www/html or /var/www/nextcloud).
I also found some solutions from other people to edit some conf files to redirect (000-default.conf, default-ssl.conf, nextcloud-ssl.conf) of apache, but all this did’t help.

I’m really confused.

The rewrite rules go in the Apache site config.

Hello,
The .htaccess is in /var/www/nextcloud. There is only one .htaccess in /var/www/nextcloud.
Read this to understand .htaccess
https://httpd.apache.org/docs/2.4/en/howto/htaccess.html

When you edit .htaccess, dont forget to reload configuration with :
sudo systemctl reload apache2
or
(sudo systemctl restart apache2)

Ok, I edited /var/www/nextcloud/.htaccess:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_USER_AGENT} DavClnt
  RewriteRule ^$ /remote.php/webdav/ [L,R=302]
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/host-meta /nextcloud/public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /nextcloud/public.php?service=host-meta-json [QSA,L]
  RewriteRule ^\.well-known/webfinger /nextcloud/public.php?service=webfinger [QSA,L]
  RewriteRule ^\.well-known/nodeinfo /nextcloud/public.php?service=nodeinfo [QSA,L]
  RewriteRule ^\.well-known/carddav /nextcloud/remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
  RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>

But the warning is still there.

I read the doc and im not sure to understand :

According to me, it means that :
-If your url is http(s)://mydomain/nextcloud, so you need to edit the .htaccess in /var/www with RewriteRule ^.well-known/carddav /nextcloud/remote.php/dav/ [R=301,L]

 -if your url is http(s)://mydomain, you need to edit the .htaccess in /var/www/nextcloud with RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]

Dont forget to restart apache2 !

Documentation :
"
If Nextcloud is running at the document root of your Web server the correct URL is:

https://example.com/remote.php/dav for CardDAV and CalDAV and https://example.com/public.php?service=webfinger

and if running in a subfolder like nextcloud :

https://example.com/nextcloud/remote.php/dav https://example.com/nextcloud/public.php?service=webfinger

For the first case the .htaccess file shipped with Nextcloud should do this work for you when you’re running Apache. You need to make sure that your Web server is using this file. Additionally, you need the mod_rewrite Apache module installed to process these redirects.

If your Nextcloud instance is installed in a subfolder called nextcloud and you’re running Apache create or edit the .htaccess file within the document root of your Web server and add the following lines:"
"

The nginx doc is clearer : https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html and confirm what I said

Installation: /var/www/nextcloud
URL: https://myDomain (without nextcloud or whatever)

So witch .htaccess should I edit? And what should I add or remove in this file?
Because I edited /var/www/nextcloud/.htaccess, but it doesn’t matter if I add “/nextcloud/…” or not, I always have the problem.

According to the doc, you need to edit the .htaccess in /var/www/nextcloud/.htaccess
And without “/nextcloud/”

RewriteRule ^.well-known/carddav /remote.php/dav/ [R=301,L]
RewriteRule ^.well-known/caldav /remote.php/dav/ [R=301,L]

Then : sudo systemctl restart apache2

If it doesn’t work, you can try to edit the main file configuration of your nextcloud, in /etc/apache2/sites-available/??? (nextcloud, nextcloud.conf, 000-default…). It comes down to the same, Apache first read your main configuration and then the .htaccess. So, you can just edit the main config if you want to be sure it works

Ok, I edited my /var/www/nextcloud/.htaccess and /var/www/.htaccess and /etc/apache2/sites-available/000-default.conf like this:

RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]

and restarted the web server, but the problems are still there.

In /etc/apache2/sites-available/ there are this files:

  • 000-default.conf
  • default-ssl.conf
  • ncp-activation.conf
  • ncp.conf
  • nextcloud-ssl.conf

000-default.conf is the only one with a part.

Hello,

  1. Can you list the content of /etc/apache2/sites-enabled ant post contents of files in /etc/apache2/sites-enabled

  2. Check your syntax with sudo apachectl -t

Good luck :wink:

Hello,

I have the same problem. I did the same on my .htaccess and still have the notification.

I don’t know if it helps, but the documentation tells this, too :

"Now change the URL in the client settings to just use:

https://example.com

instead of e.g.

https://example.com/nextcloud/remote.php/dav/principals/username."

But it is impossible, in the client you can just copy the url, not change it !

contacts

(Sorry if this message is not helpful, I am a beginner. For information my nextcloud is built on a shared server and I work on it on windows via ftp.)

This is supposed to be done in your Apache site config… not .htaccess unless you are not the server admin.

<VirtualHost *:443>
  ServerName cloud.domain.name
  ErrorLog ${APACHE_LOG_DIR}/nextcloud-error.log
  CustomLog ${APACHE_LOG_DIR}/nextcloud-access.log combined
  SSLEngine On
  ProxyPreserveHost On
  ProxyPass    / http://127.0.0.1:8080/
  ProxyPassReverse / http://127.0.0.1:8080/
  # Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
  RewriteEngine On
  RewriteRule ^/\.well-known/carddav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
  RewriteRule ^/\.well-known/caldav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
  SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
  SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
</VirtualHost>

Actually, the documentation of NextCloud says to edit the .htaccess but the documentation of apache advises to edit your config file rather than a .htaccess. It’s not really important… In both cases, it’s supposed to work.
https://docs.nextcloud.com/server/latest/admin_manual/issues/general_troubleshooting.html#service-discovery
https://httpd.apache.org/docs/2.2/en/howto/htaccess.html

  • 000-default.conf
  • ncp.conf
  • nextcloud.conf
  • nextcloud-ssl.conf

Syntax OK

Hey,
So you have to edit your nextcloud config. It can be nextcloud.conf or nextcloud-ssl.conf. I think that its nextcloud-ssl.conf.
To be sure, add Rewrite Rule in sites-available/000-default.conf, sites-available/ncp.conf, sites-available/ncp.conf, sites-available/ncp.conf. And restart apache.

Ok, I edited the files.
000-default.conf

<VirtualHost _default_:80>
  DocumentRoot /var/www/nextcloud
  <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
    RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
  </IfModule>
</VirtualHost>

ncp.conf

Listen 4443
<VirtualHost _default_:4443>
  DocumentRoot /var/www/ncp-web
  SSLEngine on
  SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
  SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

  # 2 days to avoid very big backups requests to timeout
  TimeOut 172800

  <IfModule mod_authnz_external.c>
    DefineExternalAuth pwauth pipe /usr/sbin/pwauth
  </IfModule>

  <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
    RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
  </IfModule>

</VirtualHost>
<Directory /var/www/ncp-web/>

  AuthType Basic
  AuthName "ncp-web login"
  AuthBasicProvider external
  AuthExternal pwauth

  SetEnvIf Request_URI "^" noauth
  SetEnvIf Request_URI "^index\.php$" !noauth
  SetEnvIf Request_URI "^/$" !noauth
  SetEnvIf Request_URI "^/wizard/index.php$" !noauth
  SetEnvIf Request_URI "^/wizard/$" !noauth

  <RequireAll>

   <RequireAny>
      Require host localhost
      Require local
      Require ip 192.168
      Require ip 172
      Require ip 10
      Require ip fe80::/10
      Require ip fd00::/8
   </RequireAny>

   <RequireAny>
      Require env noauth
      Require user ncp
   </RequireAny>

  </RequireAll>

</Directory>

nextcloud-ssl.conf

<VirtualHost *:443>
        ServerAdmin gambajo@posteo.de
        ServerName ortmann-media.eu
        DocumentRoot /var/www/nextcloud
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine on
        SSLCertificateFile /etc/letsencrypt/live/ortmann-media.eu-0001/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/ortmann-media.eu-0001/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

  <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
    RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
  </IfModule>
</VirtualHost>

Problem is still there. :disappointed_relieved:

Your right configuration is nextcloud-ssl.conf. Its useless to edit ncp.conf and 000-default.conf. Can I see nextcloud.conf configuration ?
Did you restart apache ? (sudo systemctl restart apache*)

Add this line and restart apache.

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
  RewriteRule ^\.well-known/webfinger /public.php?service=webfinger [QSA,L]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
</IfModule>

My nextcloud-ssl.conf now:

<VirtualHost *:443>
        ServerAdmin gambajo@posteo.de
        ServerName ortmann-media.eu
        DocumentRoot /var/www/nextcloud
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine on
        SSLCertificateFile /etc/letsencrypt/live/ortmann-media.eu-0001/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/ortmann-media.eu-0001/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
  <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
    RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
    RewriteRule ^\.well-known/webfinger /public.php?service=webfinger [QSA,L]
    RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
    RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  </IfModule>
</VirtualHost>

There is no such file.

Yes, sometimes even the whole Pi.

In /etc/apache2/sites-enabled ?

  • @000default.conf
  • @ncp.conf
  • @nextcloud-ssl.conf
  • !nextcloud.conf (file is empty/new file)

Hey,
I’m sorry for responding so late. nextcloud.conf is useless too.
I dont know why but your Apache config disables rewrite rule. Be sure that rewrite rule are enabled :

sudo a2enmod rewrite
sudo systemctl restart apache2

And remove rewrite rule that you have created in the .htaccess