[Bug]: Mac desktop client cannot connect to some self‑hosted servers using internal CA (works from browsers and other OS clients)
⚠️ Before submitting, please verify the following: ⚠️
- [x] This is a bug, not a question or a configuration issue.
- [x] This issue is not already reported on Github (I've searched it).
- [x] Nextcloud Server and Desktop Client are up to date. See Server Maintenance and Release Schedule and Desktop Releases for supported versions.
- [x] I agree to follow Nextcloud's Code of Conduct
Bug description
On macOS the Nextcloud desktop client cannot establish a secure connection to some of my self‑hosted Nextcloud servers that use certificates from the same internal CA. The exact same servers work fine:
-
in all browsers on macOS
-
with the Windows and Linux desktop clients
-
with an other Nextcloud server that uses the same CA chain.
On macOS, the account setup wizard immediately shows: “Secure connection to server address https://… failed. How do you want to proceed?” It offers only “Use different URL / Try unencrypted HTTP / Configure client TLS certificate”, but no certificate details or trust prompt.
After I completely removed the client configuration and containers and reinstalled, the problem persists. Interestingly, if I start the client manually from Terminal with:
/Applications/Nextcloud.app/Contents/MacOS/nextcloud
I can add the problematic accounts successfully and syncing works.
This looks like a macOS‑specific initialization / TLS handling bug that affects only some servers, even though their certificate chains are valid and identical to the working one
Environment
Desktop client: 33.0.2 (macOS build) OS: macOS (26.4) on M1 MacBook Pro Installation: official .app (and tested via Homebrew cask) Nextcloud servers: multiple self‑hosted instances 2x behind Traefik (Docker) 1x separate Apache server (no Docker, no Traefik) Certificates: all servers use the same internal PKI: RootCA → Sub1CA → Signing1CA → leaf cert Full chain is presented correctly; openssl s_client -showcerts verifies Verify return code: 0 (ok) on all servers. All servers are reachable and trusted in Safari/Chrome/Firefox on the same Mac.
Steps to reproduce
- On macOS, install the desktop client (33.0.2).
- Ensure the internal CA (Root + intermediates) is imported into the macOS System keychain and set to “Always trust”.
- Start the client normally (Dock / Launchpad).
- Try to add an account for https://nextcloud.example.local (affected server).
- The wizard shows “Secure connection failed …” with the three buttons mentioned above and does not allow trusting the certificate.
- Quit the client.
- Start the client from Terminal with:
/Applications/Nextcloud.app/Contents/MacOS/nextcloud - Repeat the account setup for the same server → now the connection succeeds and the account is added.
Expected behavior
The macOS client should use the same TLS / trust behavior regardless of how it is started, and it should be able to connect to all servers whose certificate chains validate in the macOS keychain and with openssl s_client.
If there is a certificate problem, the client should show a clear trust dialog (similar to browsers), not only a generic “Secure connection failed” page.
Which files are affected by this bug
Nextcloud-33.0.2.pkg
Operating system
macOS
Which version of the operating system you are running.
26.4
Package
Official macOS 12+ universal pkg
Nextcloud Server version
33.0.2
Nextcloud Desktop Client version
33.0.2
Is this bug present after an update or on a fresh install?
Fresh desktop client install
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
Are you using an external user-backend?
- [ ] Default internal user-backend
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other
Nextcloud Server logs
Additional info
No response
OS/DISTRO: LInux/Ubuntu 24.04.4 Server variant: docker > linuxserver/nextcloud
I have a similar issue here. At some point during the week my desktop client ceased to actually connect to my self host of Nextcloud. I thought, "hey I should update maybe that will fix it". Fix it, it did not...
I then went into my .config and .local and deleted Nextcloud to start it up as if it was new. I typed in my nextcloud's sub domain, all I get is:
In our case, we were seeing the same "Failed to connect to the secure server address" window, along with the error message OCA\DAV\Connector\Sabre\Exception\TooManyRequests. It turned out to have nothing to do with TLS, and was instead due to the connecting client's IP being temporarily throttled by brute force protection. Once that cleared the issue went away.
thanks for the report, we will look into it.
In our case, we were seeing the same "Failed to connect to the secure server address" window, along with the error message
OCA\DAV\Connector\Sabre\Exception\TooManyRequests. It turned out to have nothing to do with TLS, and was instead due to the connecting client's IP being temporarily throttled by brute force protection. Once that cleared the issue went away.
Yea... turns out I've accidently deleted my API token for letsencrypt. I am all good now.
I have the same issue.
How ever I could not found the log ToomanyRequests in logreader ( FQDN/settings/admin/logging ).
Just in case, I added my local IP address to the brute-force whitelist (in Security page FQDN/settings/admin/security ), but I still cannot resolve the issue.
Sorry my interface language is Japanese.
あなたのリモートアドレスは"192.168.1.1"として認識され、ブルートフォース保護をバイパスしています。
is Your remote address is recognized as "192.168.1.1" and is bypassing the brute-force protection.
In Nextcloud-33.0.2.pkg on macOS Sequoia 15.7.3.
I was able to reproduce this on macOS and confirm it is not caused by server misconfiguration.
Findings:
- Nextcloud Desktop 4.0.2 works
- current versions fail during login
- server endpoints behave correctly (status.php, OCS, DAV)
I tested a minimal change in src/libsync/accessmanager.cpp:
newRequest.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
With this change:
- Login Flow v2 completes
- account setup succeeds
- DAV access works
I opened a PR with this fix: https://github.com/nextcloud/desktop/pull/9861
Closing as resolved after an automated backlog review. The reporter traced the failure to a custom Apache rewrite that redirected the required /index.php/204 connectivity probe. Exempting that endpoint restored login and DAV access with the current client, and the proposed client change was closed after confirming this was server configuration rather than a Desktop regression.
I finally solved this issue with the help of ChatGPT.
The problem was that my web server was not sending the intermediate CA certificates.I changed the certificate file from cert.pem to fullchain.pem, and the Nextcloud Desktop client connected successfully.
I used the following command to check the certificate chain:
openssl s_client \
-connect FQDN:PORT \
-servername FQDN \
-showcerts </dev/null 2>&1 |
grep -E '^[[:space:]]*[0-9]+ s:|Verify return code|verify error'
When I was using cert.pem, only one certificate was displayed:
0 s:CN=DOMAIN
After changing to fullchain.pem, three certificates were displayed:
0 s:CN=DOMAIN
1 s:C=US, O=Let's Encrypt, CN=YR1
2 s:C=US, O=ISRG, CN=Root YR
Thank you, everyone!