Nginx Caldav/Carddav Resolving

Nextcloud version: 18.0.1
Operating system and version: docker/containerized
Nginx version: 1.17.8
PHP version: 7.3.15

The issue you are facing:
I installed nextcloud as the docker nextcloud:fpm image with nginx running in a separate docker container similar to the setup here.
Everything is working fine, except that I am recieving the following two warnings from the systemcheck:

Caldav/Carddav 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.

I know that these warnings were already solved in various forum posts, however, my nginx server is running with the exact configuration from docker-compose example and if I visit https://<cloud.mydomain.com>/.well-known/caldav I am redirected to https://<cloud.mydomain.com>/remote.php/dav, so as far as I can see all should be working, however the automatic test is still showing the warnings.

I am running another nginx proxy in front of the nginx issuing the fpm calls, can this somehow cause this problem?

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

The output of your Nextcloud log in Admin > Logging:
No warnings or errors in the log.

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

<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'oc60t418l512',
  'passwordsalt' => '<salt>',
  'secret' => '<secret>',
  'trusted_domains' => 
  array (
    0 => '<cloud.mydomain.com>',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '18.0.1.3',
  'overwrite.cli.url' => '<cloud.mydomain.com>',
  'dbname' => 'nextcloud',
  'dbhost' => 'nextcloud-db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '<db-pwd>',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:
Access log entries right after accessing https://<cloud.mydomain.com>/.well-known/caldav


192.168.178.116 - - [02/Mar/2020:19:35:31 +0000] "GET /.well-known/caldav HTTP/1.1" 301 169 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0" "192.168.178.116"
192.168.178.116 - - [02/Mar/2020:19:35:31 +0000] "GET /remote.php/dav HTTP/1.1" 200 122 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0" "192.168.178.116"

Which of those nginx handles ssl termination?

I found that just removing $server_port from the 301 redirect solves this problem, because if the fpm nginx listens on port 80, it will issue a 301 to httpS://example.com:80, that usually won’t work.

Thank you very much, that was exactly what I was missing. Now everything works fine

Yeah, it looks like a strange default there :wink:

In wich file do I find the $server_port in?

I may have the same problem, thanks

It’s (was?) in the default nginx config file (kinda /etc/nginx/sites-enabled/nextcloud.conf or similar)