Mac OS sync doesn't work for me

Hey guys
I have organized my various (windows & androids) calendars to sync with my let’s encrypt certified nextcloud and this worls all fine but than I tried to sync the mac products of my wife and I am despairing right now … she runs mac os 12.x on her iphone and mac os 13.x on her ipad. The .well-known/caldav redirection is working but I just get the error message “verbindung über ssl unmöglich” in english: Cannot connect using SSL but I can’t find any logs on my server (maybe someone here knows better than I where to look) or solutions … you are my last hope …

please tell me if you need more information …

Has anybody an Idea?

Hello,
Can you display error.log in /var/log/apache/error.log ?
Do you have the last version available of mac ? Try to upgrade your mac

[Tue Aug 18 06:25:09.768289 2020] [ssl:warn] [pid 30531] AH01916: Init: (127.0.1.1:443) You configured HTTP(80) on the standard HTTPS(443) port!
[Tue Aug 18 06:25:09.768853 2020] [mpm_prefork:notice] [pid 30531] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 configured – resuming normal operations
[Tue Aug 18 06:25:09.768914 2020] [core:notice] [pid 30531] AH00094: Command line: ‘/usr/sbin/apache2’
[Tue Aug 18 18:12:52.706494 2020] [php7:error] [pid 26435] [client 47.52.98.110:40574] script ‘/var/www/html/xmlrpc.php’ not found or unable to stat
[Tue Aug 18 20:16:49.713199 2020] [php7:notice] [pid 26415] [client 31.16.5.129:57732] {“reqId”:“7lV3urSgyt6emaREGr7i”,“level”:2,“time”:“2020-08-18T18:16:49+00:00”,“remoteAddr”:“31.16.5.129”,“user”:"–",“app”:“no app in context”,“method”:“POST”,“url”:"/NC/index.php/login",“message”:“Login failed: ME (Remote IP: 31.16.5.129)”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0”,“version”:“18.0.7.1”}
[Tue Aug 18 20:17:02.117162 2020] [php7:notice] [pid 26400] [client 31.16.5.129:57734] {“reqId”:“GTCAkAZryMOAsvPrqYrd”,“level”:2,“time”:“2020-08-18T18:17:02+00:00”,“remoteAddr”:“31.16.5.129”,“user”:"–",“app”:“no app in context”,“method”:“POST”,“url”:"/NC/index.php/login",“message”:“Login failed: User Name (Remote IP: 31.16.5.129)”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0”,“version”:“18.0.7.1”}

I hope this helps - I don’t know what to do now … :grimacing:

Hello,
Do you have configured nextcloud on port 443 with https?
Can you display your Apache config?

Hey bastien,
thanks for your help! Yes, the nextcloud ist availabel via port 443 (it’s configured as a subdomain but the .well-known request works with the "main"domain - nextcloud is the only cladav/carddav instance…)

I hope the following config of my nexcloud-host ist helpfull

<VirtualHost _default_:443>
<Directory /var/www/NC/>
  Options +FollowSymlinks
  AllowOverride All

 <IfModule mod_dav.c>
  Dav on
 </IfModule>

 SetEnv HOME /var/www/NC
 SetEnv HTTP_HOME /var/www/NC

</Directory>
 <IfModule mod_headers.c>
     Header always set Strict-Transport-Security "max-age=15768000; preload"
     #Header always set Referrer-Policy no-referrer		schon in NC .htaccess gesetzt
     Redirect 301 /.well-known/carddav /NC/remote.php/dav
     Redirect 301 /.well-known/caldav /NC/remote.php/dav
 </IfModule>

     SSLEngine on

     ServerName my.main.server							#the nexcloud-website is configured as subdomain but the .well-known command works with this domain
     SSLCertificateFile /etc/letsencrypt/live/path/to/certificate.pem
SSLCertificateKeyFile /etc/letsencrypt/live/path/to/certificate
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

#<VirtualHost *:80>
#   RewriteEngine On
#   RewriteCond %{HTTPS} off
#   RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
#</VirtualHost>

<VirtualHost _default_:80>
ServerName my.main.server

ServerSignature Off

RewriteEngine On
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

ErrorLog /var/log/apache2/redirect.error.log
LogLevel warn
</VirtualHost>

This would be my general apache-config:

# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#	/etc/apache2/
#	|-- apache2.conf
#	|	`--  ports.conf
#	|-- mods-enabled
#	|	|-- *.load
#	|	`-- *.conf
#	|-- conf-enabled
#	|	`-- *.conf
# 	`-- sites-enabled
#	 	`-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
#
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections which can be
#   customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
#   directories contain particular configuration snippets which manage modules,
#   global configuration fragments, or virtual host configurations,
#   respectively.
#
#   They are activated by symlinking available configuration files from their
#   respective *-available/ counterparts. These should be managed by using our
#   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
#   their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.


# Global configuration
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
Mutex file:${APACHE_LOCK_DIR} default

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
	Options FollowSymLinks
	AllowOverride All
	Require all denied
</Directory>

<Directory /usr/share>
	AllowOverride None
	Require all granted
</Directory>

<Directory /var/www/>
	Options FollowSymLinks
	AllowOverride All
	Require all granted
</Directory>

#<Directory /srv/>
#	Options Indexes FollowSymLinks
#	AllowOverride None
#	Require all granted
#</Directory>




# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
	Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Does anyone find a mistake? …

This is very important for me cause I would like to realize the sync with my wifes devices (all apple) via our own server …

Try to tag me the next time or click on “respond” : I never received any notif for this thread.
Is it working with firefox or safari or chrome ? According to the log, the login failed. So try to connect to nextcloud from the Iphone.
Do you have any warning on the overview in nextcloud settings (on admin account) ?

That looks odd to me.
Could you post the output of this command?

curl -IL https://my.main.server/.well-known/caldav

Ok … this ist the output:
HTTP/1.1 301 Moved Permanently
Date: Tue, 15 Sep 2020 21:02:15 GMT
Server: Apache/2.4.29 (Ubuntu)
Location: https://my.main.server/.well-known/caldav
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 301 Moved Permanently
Date: Tue, 15 Sep 2020 21:02:15 GMT
Server: Apache/2.4.29 (Ubuntu)
Strict-Transport-Security: max-age=15768000; preload
Referrer-Policy: no-referrer
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Robots-Tag: none
X-XSS-Protection: 1; mode=block
Location: https://my.main.server/remote.php/dav/
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 404 Not Found
Date: Tue, 15 Sep 2020 21:02:15 GMT
Server: Apache/2.4.29 (Ubuntu)
Strict-Transport-Security: max-age=15768000; preload
Content-Type: text/html; charset=iso-8859-1

I hope this is helpfull …

I already tried to connect via iPhone, iPad and Macbook … nothing works - but I have no problems with my Windows-based programs (Windows calendar, Outlook …)

That should be a 401 instead of a 404. Under which URL do you login to Nextcloud?

I have arranged a redirection from a subdomain of my website via my router to my NAS…
is this enough information? It’s “just” a normal private network (and secured like this) so that I don’t want to write the URL in a public forum. But I coult send a PN if you need this information …

Do you access your nextcloud via webroot (sub.example.com)
or via a subfolder of webroot (sub.example.com/subfolder)
?

Oh sorry I confounded this - it’s a subfolder…

From the documentation (General troubleshooting — Nextcloud latest Administration Manual latest documentation):

If you visit https://my.main.server/.well-known/caldav after applying that change with a browser, you should get prompted to enter your username and password. After entering the correct credentials the website should say : “This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.”. This is what you need to setup an iOS device.

When this is working, follow the documentation to add your caldav/carddav account to your iOS device (take care to only give the domain-name and not the subfolder path!): Synchronizing with iOS — Nextcloud latest User Manual latest documentation

I already get the "This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.” - message by entering the website …