Nextcloud useless due to "untrusted domain" error

Hi, This is on fresh Ubuntu 18.04. First used the nextcloud snap install, Couldn’t access from other address than localhost, showing up “access through untrusted domain”. Tried from different machines with different browsers and clients. Added trusted domains to config.php, as described in the tutorials. To be sure I decided to make a manual install. Everything installed fine, but server access again only from localhost. Updated server from 13.0.3 to 13.0.4, but no luck.
Nextcloud is now useless for me, after using it for years, as I can’t access from elsewhere. Please help.

Have you installed Letsencrypt? I installed NC on Stretch last month, enable https (no more http) is a must.

When you connect locally via IP (eg. 192.168.1.20) you need to add this IP in your config to “trusted domains”. When you using something else you have to also enter this to your config.php

Thanks for the answer. No, no encryption. I use http.

Yes, trusted domains are already included in the config.php-file in var/www/html/nextcloud/config/. Is there a way to see the config file in the gui, just to be sure it is exactly THIS file, I’m using? Or to see from gui which domains are registered as trusted?

1 Like

That should indeed be the file. You probably know to check Nextcloud’s logs for any unusual messages, but if we could have a look at the file we could check it for syntax errors and such. You’d of course want to munge database keys, etc.

This is a modified version. Before it looked like this:

‘trusted:_domains’ =>
array (
1 => ‘localhost’,
2 => ‘…’
),

I have modified it to try out different versions I have seen in the tutorials.

i’m not commenting on any setup in your config.php…
but i just wanted to let you know that you just have compromised your server by makeing sensitive data public. for your own saftey pls remove this posting completely.

then just copy and paste your config.php here… and take care of removing sensitive data like passwords, etc

<?php $CONFIG = array (... 'trusted_domains' => array ( 'localhost', '192.168.1.189', '192.168.1.150', ), 'datadirectory' => '/var/www/html/nextcloud/data', 'overwrite.cli.url' => 'http://localhost/nextcloud', 'dbtype' => 'mysql', 'version' => '13.0.4.0', 'dbname' => 'nextcloud', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'mysql.utf8mb4' => true, 'dbuser' => '', 'dbpassword' => '', 'installed' => true, 'updater.secret' => 'i', 'maintenance' => false, 'theme' => '', 'loglevel' => 2, );

I hope to have deleted all secret information. It’s only my home office network.

add also 127.0.0.1 sometime localhost doesnt work.

Also, verify your ipv6 is deseable

It may be due to some weird false localhost network

Localhost works. Only localhost, no connection over wifi from browsers or clients. If I use localhost/nextcloud it works, but 192.168.1.158/nextcloud from localhost, also localhost is untrusted.
“Also, verify your ipv6 is deseable”
How do I do that?
I think I don’t have any weird networks, as it is a fresh install. But how could I find out about that?
Thanks for the replies.

two possibilities:


routeur side: access your routeur, find the option, turn it off


server side:

open /etc/sysctl.conf

insert the following lines at the end:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

If ipv6 is still not disabled, then the problem is that sysctl.conf is still not activated

then

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

It will report:

1

If 1 is shown, ipv6 has been successfully disabled.

A reboot might be necessary.

thir way exist also, but involve to modify grub…

First, sorry I wasn’t more specific about which fields should be considered sensitive.

I actually don’t see 192.168.1.158 on your list - is this a typo or is that IP not supposed to be allowed? Perhaps the IP of your server box changed recently?

You got it! My server domain was untrusted, and this was exactly what it said. I didn’t understand, know, or remember, that I had to add server’s IP besides ‘localhost’ to connect from other IPs. This solved my problem, and for sure it was mentioned in the tutorials. Thanks to all for your precious help.

@kleinempfaenger
Please tick box solved

Hey guys i ran into the same problem. I am using ngrok to create a url for my localhost and i added it to the trusted domain. When i click on the url it still does not work.