Well-known warning

Support intro

On a freshly installed 17.0.1 I got this warnings:

Your web server is not properly set up to resolve "/.well-known/caldav". Further information can be found in the documentation.
Your web server is not properly set up to resolve "/.well-known/carddav". Further information can be found in the documentation.

My server is configured to run in a subfolder, which is “nextcloud”. So the setup is kind of standard. Warings, content of the .htaccess, and linked documentation leave me helpless.

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): 17.0.1
Operating system and version (eg, Ubuntu 17.04): Debian GNU/Linux 9 (stretch)
Apache or nginx version (eg, Apache 2.4.25): 2.4.25
PHP version (eg, 7.1): 7.2.25

The issue you are facing:

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

No, I have seen this on a different setup before.

Steps to replicate it:

  1. Create a virtual host for Nextcloud folder.
  2. Create and install by manual downloading and webinstall.
  3. Check configuration within the web interface.
  4. Copy and paste recomanded configuration at the bottem of the .httaccess file. There is a .httaccess file shiped with the installation. See below.
  5. Check configuration again.

The output of your Nextcloud log in Admin > Logging:

Nothing logged yet

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!). This is the file, the setup creates – I did not change anything:

<?php
$CONFIG = array (
  'instanceid' => 'xx',
  'passwordsalt' => 'XX',
  'secret' => 'XX',
  'trusted_domains' =>
  array (
    0 => 'xx.de',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '17.0.1.1',
  'overwrite.cli.url' => 'https://xx.de/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'XX',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:

Nothing logged yet.

The messages links to this page: https://docs.nextcloud.com/server/17/admin_manual/issues/general_troubleshooting.html#service-discovery

There I found the following paragraph:

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:
<IfModule mod_rewrite.c>
  RewriteEngine on
  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/carddav /nextcloud/remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]
</IfModule>

The Text “create” is quite confusing, because the setup is shipped with a .htaccess file. I miss a clear and understandable explaniation how I can deal with exsiting mod_rewrite blocks.

Here is the content of my .htaccess file. According to #### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####, I did put the mod_rewrite block from the linked document at the bottem:

<IfModule mod_headers.c>
  <IfModule mod_setenvif.c>
    <IfModule mod_fcgid.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
       SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
  </IfModule>

  <IfModule mod_env.c>
    # Add security and privacy related headers
    Header always set Referrer-Policy "no-referrer"
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Download-Options "noopen"
    Header always set X-Frame-Options "SAMEORIGIN"
    Header always set X-Permitted-Cross-Domain-Policies "none"
    Header always set X-Robots-Tag "none"
    Header always set X-XSS-Protection "1; mode=block"
    SetEnv modHeadersAvailable true
  </IfModule>

  # Add cache control for static resources
  <FilesMatch "\.(css|js|svg|gif)$">
    Header set Cache-Control "max-age=15778463"
  </FilesMatch>

  # Let browsers cache WOFF files for a week
  <FilesMatch "\.woff2?$">
    Header set Cache-Control "max-age=604800"
  </FilesMatch>
</IfModule>
<IfModule mod_php7.c>
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<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 /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/nodeinfo /public.php?service=nodeinfo [QSA,L]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /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>
<IfModule mod_mime.c>
  AddType image/svg+xml svg svgz
  AddEncoding gzip svgz
</IfModule>
<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>
AddDefaultCharset utf-8
Options -Indexes
<IfModule pagespeed_module>
  ModPagespeed Off
</IfModule>
#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####

<IfModule mod_rewrite.c>
  RewriteEngine on
  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/carddav /nextcloud/remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]
</IfModule>

Whats wrong? Should I replace somehting of the first mod_rewrite block? Why is there a strict warning?

I would appreciate any help.

You need to add that block to the .htaccess file in the root directory of the Webserver.

@Bernie_O: Thx for your fast replay! I googled a bit around and I’m not sure, what in this case is meant by “dokument root of the webserver”. For me it is not clear what is meant by that. In which of the apache 2.4-debian configuration files the documentroot is set for the webserver (by default)? Or, Is there a command which displays the necessary directory for this .htaccess file? Mayby I’m wrong, but I thought the alias (Alias /nextcloud “/var/www/nextcloud/”) in the nextcloud host configuration file overwrites the document root. It thought it workes, becaus files are delivered fine, except that warning. Or should I set DocumentRoot in the host file for the nextcloud subdirectory?

From the configuration you posted I assume you are accessing your nextcloud via https://xx.de/nextcloud - this is a subfolder of the document root. The document root would be https://xx.de.

EDIT: replaced webroot with document root