CalDAV and CardDAV web server set up

Instance details:
Operating System: Ubuntu 22.04.3 LTS aarch64
Nextcloud version: Nextcloud Hub 5 (27.0.1)
Web server: Apache 2
Installation type: Using the official docker image
Database: PostgresSQL
Domain example: cloud.mydomain.tld

Getting this warning in the Administration overview since 5 months, got fed up and left it for a few months, I really am annoyed by this. I want to fix this once and for all. Yes I have read the documentation, yes I have edited the .htaccess file and the file in /etc/apache2/sites-available/default-ssl.conf, yes I have read all the other posts in this forum but still I couldn’t solve it.

My /etc/apache2/sites-available/default-ssl.conf file (I have removed the comments):
<VirtualHost *:443>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLEngine on

SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

<FilesMatch “.(?:cgi|shtml|phtml|php)$”>
SSLOptions +StdEnvVars

<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars

Redirect CalDAV and CardDAV clients

RewriteEngine On
Redirect 301 /.well-known/carddav /remote.php/dav
Redirect 301 /.well-known/caldav /remote.php/dav

can you please tell me what am I doing wrong? I really want to get rid of this annoying warning.

Are you actually terminating HTTPS (“SSL”) on this container or are you using a reverse proxy?

I am using Cloudflare Tunnels as my reverse proxy

You should not need to edit your .htaccess. If you have, please reverse it. Modifying it could actually be the source of your problems.

As long as your .htaccess is the standard one, you also should not have any .well-known related entries in any of your /etc/apache2 files (such as the one you provided above). After cleaning up your /etc/apache2 files, make sure to restart Apache for the changes to take effect.

As an aside, your existing Redirects are a little strange: you’re enabling the RewriteEngine but instead of using RewriteRule’s you’re then only using Redirects. In any case, remove them. :slight_smile:

Without knowing more about what other customization you’ve made, it’s challenging to say with any certainty.

Try the below maybe before and after making the above changes

What happens if you visit https://cloud.mydomain.tld/.well-known/caldav in your browser? It’s not exactly the same test NC triggers (since that uses a PROPFIND) but it still should give you an idea about how far it’s getting…

It should be exactly the same (in browser at least) as visiting https://cloud.mydomain.tld/remote.php/dav/:

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

Then on Cloudflare you need to do this basically:

Thank you! It’s solved now.

1 Like