Warnings about caldav, carddav, webfinger and nodeinfo in Nextcloud

Warnings:

Your web server is not properly set up to resolv “/.well-known/webfinger”.
Your web server is not properly set up to resolv “/.well-known/nodeinfo”.
Your web server is not properly set up to resolv “/.well-known/caldav”.
Your web server is not properly set up to resolv “/.well-known/carddav”.


Solution:


In the following configuration file
/etc/apache2/sites-enabled/000-default-le-ssl.conf

(If the file doesn't exist, just create one)

insert the following:


<IfModule mod_headers.c>

Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains; strict-origin; preload"

Redirect 301 /.well-known/carddav /remote.php/dav

Redirect 301 /.well-known/caldav /remote.php/dav

Redirect 301 /.well-known/webfinger /index.php/.well-known/webfinger

Redirect 301 /.well-known/nodeinfo /index.php/.well-known/nodeinfo

</IfModule>


If your nextcloud is not in the document root, but e.g. in the subfolder "nextcloud", the paths must be adapted:


<IfModule mod_headers.c>

Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains; strict-origin; preload"

Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav

Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav

Redirect 301 /.well-known/webfinger /nextcloud/index.php/.well-known/webfinger

Redirect 301 /.well-known/nodeinfo /nextcloud/index.php/.well-known/nodeinfo

</IfModule>


And then restart the web server

service apache2 restart