Android App Could Not Find Host via URL

I have a Nextcloud Server (version 23.0.3) running on TrueNAS Core 12 Update 8. I have configured it with both IPv4 and IPv6 addresses which resolve using my own DNS server hosted locally (also on TrueNAS).

I can connect to it via my Windows Desktop client without issues. I can also connect to it via web browsers (edge, Chrome and Firefox) on both Windows and Android devices.

However, when I try to connect to it via the Android App (version 3.19.1) using the URL (which I have copied from logging into my account via the web browser to avoid typos) or by scanning the QR code, I get “Could not find host”. When I try to use the IPv4 address instead it connects (but I get a certificate error as my certificates aren’t configured to use IP addresses).

Have I missed an entry in the trusted hosts section of config.php or something simple, to allow the Android app to connect?

Do you really need IPv6? If not you can deactivate it.
Also should you always use only one Nextcloud name. This is the external name with https://. If you configure everything correctly, access from the inside works just as well as from the outside.

Perhaps you must set in Nextcloud configuration that always only the external name is used.

Thanks for the quick reply.

I originally only had IPv4 on my network and after reading that Nextcloud has a preference of IPv6 over IPv4 and some similar issues resolved by correctly configuring IPv6 I tried enabling it to see if it helped which is didn’t.

I only use Nextcloud on my home network with no access from external networks (i.e. over the internet). I have tried specifying the single https:// URL in config.php and this did not resolve the issue.

Which server settings does you use? Can you use the exact server setting for the Android app? Please post more details and maybe some logs.

When you say server settings, what are you referring to exactly?

In /path/to/nextcloud/config/config.php you can set the Nextcloud server name and alternative names.

In config.php I have set “host =>” and I have trusted domains “0 =>” and the “1 => {IPv4 address of the server}”. This configuration, as I said, seems to work with browsers and the Windows desktop client.

Yes. But try to use only You do not need access with IPv4 address neither from the inside nor from the outside nor for a special device, if you have configured everything correctly.

Yes. But try to use only You do not need access with IPv4 address neither from the inside nor from the outside nor for a special device, if you have configured everything correctly.

Setting just the single name in Trusted Hosts does not resolve the issue. Although, I could still access my server via the Android app via the IPv4 address.

The only configuration I have done to the plugin installation is to set the host and trusted domain for my server, otherwise everything is default. Is there separate configuration required to the Nextcloud server to allow mobile devices/apps to connect?

No, I’m not aware of a configuration that’s required for that.

But, there’s always more room for DNS problems! I think that disabling IPv6 is going to remove one variable here, and make it simpler to troubleshoot.

Here’s a potential problem: Android has “Secure DNS”, and Chrome has “DNS over HTTPS” (DoH), and both have different rules for using local DNS resolvers. Can you confirm that the TrueNAS’ DNS resolver is the only one your Android device is configured to use? Chrome might accept its answer just fine, while the Nextcloud app (using “Secure DNS”, if that’s enabled) decides to resolve it externally instead.

I originally just had an IPv4 network and this didn’t work. I searched my issue and saw posts on this forum showing that IPv6 was preferred over IPv4 and that misconfigurations had caused this issue, so I thought I would try enabling IPv6 and see if that helped which it didn’t. My DNS server resolves hostname to both IPv4 and IPv6 (and addresses to hostnames) without issue.

In Connections → Wi-Fi → “My Wi-Fi connection” → Advanced Settings I have configured manual IPv4 settings, including setting my DNS server to my local one.

Interestingly, I went to the Settings → Connections → More connection settings → Private DNS and tried to connect to my DNS server but it failed. I connected to Cloudflare’s DNS server and it appears that this Private DNS setting will override your manual DNS settings of individual connections.

Was Cloudflare a test or do you use paid Cloudflare services e.g. CDN? Please post more details. You can anonymize your ip and domains but post them including errors.

No, just used to publicly available, non-paid server ( as a test.

Some further information which may help.

When I connect to my server via a web browser, even just to the logon screen, I can see entries in my nginx access.log showing the connection.

When I try to connect to my server via the IP, I see nothing. I try to connect using the IPv4 address which seems to connect and throws up the certificate error as expected, but I see nothing in the access.log file.

There is nothing being entered in the error.log file for anything either.

I’ve connected using the IPv4 address and can configure uploads of folders on my Android device and these work fine, but using the IPv4 address is not a secure connection (certificate error as mentioned).

That’s expected: if you don’t bypass the security warning, your browser backs off before actually requesting any files. The server sees an SSL/TLS connection attempt, but default log settings don’t include those: no files have been accessed, so there isn’t much to know.

So a bit of digging has revealed that it is a DNS issue caused my my ISP router. It had IPv6 enabled on it, which meant as part of DHCP it assigned it’s link-local IPv6 address as a nameserver to my Android device. Disabling IPv6 on my router and restarting my phone removed this nameserver as the primary server and allowed my device to use my own nameserver.

Thanks for all the help and advice given.