Warning on caldav, carddav, webfinger and nodeinfo in Nextcloud

I´m facing the following problems:

  • Dein Webserver ist nicht richtig konfiguriert, um “/.well-known/webfinger” aufzulösen. Weitere Informationen hierzu findest du in unserer Dokumentation :arrow_upper_right:.
  • Dein Webserver ist nicht richtig konfiguriert, um “/.well-known/nodeinfo” aufzulösen. Weitere Informationen hierzu findest du in unserer Dokumentation :arrow_upper_right:.
  • Dein Webserver ist nicht richtig konfiguriert, um “/.well-known/caldav” aufzulösen. Weitere Informationen hierzu findest du in unserer Dokumentation :arrow_upper_right:.
  • Dein Webserver ist nicht richtig konfiguriert, um “/.well-known/carddav” aufzulösen. Weitere Informationen hierzu findest du in unserer Dokumentation :arrow_upper_right:.

This is my system:
Nextcloud version Hub 3 (25.0.1)
Operating system and version: Ubuntu, 22.04 LTS
Apache version: 2.4.52
PHP version: 8.1
Local system in a LAN

This way didn’t work for me:

Has anyone an idea how to solve this?

Please have a look on existing threads on the forum which are covering your issue:

https://help.nextcloud.com/search?q=apache%20webfinger

I’ve read and tried many things already but nothing worked for me, thats why I created this post here

bad wiki

try adding this to your website-ssl.conf

notice the mod_rewrite.c

<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]
  RewriteRule ^/\.well-known/webfinger index.php/.well-known/webfinger [R=301,L]
  RewriteRule ^/\.well-known/nodeinfo index.php/.well-known/nodeinfo [R=301,L]
</IfModule>

and this should be in your mod_headers.c

<IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=15768000; preload"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  # Prevent MIME based attacks
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "SAMEORIGIN"
</IfModule>

then enable module rewrite with

a2enmod rewrite; apache2ctl restart

where can I find this file?

/etc/apache2/sites-available/

if you have not set a personal one it’s most likely default-ssl.conf

I just added the lines from above at the very end of the file, is that correct? Because it didn’t solve the problem :frowning:

no it needs to be in the ssl module.

sample default-ssl.conf
<IfModule mod_ssl.c>
	<VirtualHost _default_:4443>
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/html

<Directory /var/www/html/>
      Require all granted
      AllowOverride All
      Options FollowSymLinks MultiViews
   <IfModule mod_dav.c>
         Dav off
   </IfModule> 
</Directory>
#  line below is for http2
#     Protocols h2 h2c http/1.1

 <IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15768000; preload"
      Header always set Referrer-Policy "strict-origin-when-cross-origin"
# Prevent MIME based attacks 
     Header always set X-Content-Type-Options "nosniff"
     Header always set X-Frame-Options "SAMEORIGIN"
</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]
           RewriteRule ^/\.well-known/webfinger index.php/.well-known/webfinger [R=301,L]
           RewriteRule ^/\.well-known/nodeinfo index.php/.well-known/nodeinfo [R=301,L]
 </IfModule>

		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
		</FilesMatch>
		<Directory /usr/lib/cgi-bin>
				SSLOptions +StdEnvVars
		</Directory>
	</VirtualHost>
</IfModule>

don’t copy all of this it’s just to show where to place it.

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin webmaster@localhost

                DocumentRoot /var/www/html

                <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]
                  RewriteRule ^/\.well-known/webfinger index.php/.well-known/webfinger [R=301,L]
                  RewriteRule ^/\.well-known/nodeinfo index.php/.well-known/nodeinfo [R=301,L]
                </IfModule>
                <IfModule mod_headers.c>
                  Header always set Strict-Transport-Security "max-age=15768000; preload"
                  Header always set Referrer-Policy "strict-origin-when-cross-origin"
                  # Prevent MIME based attacks
                  Header always set X-Content-Type-Options "nosniff"
                  Header always set X-Frame-Options "SAMEORIGIN"
                </IfModule>

                ...

Thats how the file looks now, but without any effect

notice the DocumentRoot.

is your nextcloud installed in that directory or is it installed in a subfolder ex. /var/www/html/subfolder

if it is the later you need to add the subfolder in your rewrite module section just before index.php and remote.php

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule ^/\.well-known/carddav /subfolder/remote.php/dav [R=301,L]
  RewriteRule ^/\.well-known/caldav /subfolder/remote.php/dav [R=301,L]
  RewriteRule ^/\.well-known/webfinger /subfolder/index.php/.well-known/webfinger [R=301,L]
  RewriteRule ^/\.well-known/nodeinfo /subfolder/index.php/.well-known/nodeinfo [R=301,L]
</IfModule>

I tried this too with no effect on the error message

SOLUTION:

file:
/etc/apache2/sites-enabled/000-default.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]
  RewriteRule ^/\.well-known/webfinger /index.php/.well-known/webfinger [R=301,L]
  RewriteRule ^/\.well-known/nodeinfo /index.php/.well-known/nodeinfo [R=301,L]
</IfModule>

@Vincent_Stans The difference is one slash

1 Like