Getting Access through untrusted domain message

i have NextCloud 15.0.8 working on Ubuntu 16.04 and have been using it for years. It works great locally, but now I’d like to access it remotely. For some reason I always get the Access through untrusted domain message even though my IP is listed in config/config.php (I’ve changed the IP). I’ve restart apache2 numerous times, tried reordering my trusted_domains, and tried wildcards (not sure if * works or not).

Snippet from config/config.php:
‘trusted_domains’ =>
array (
0 => ‘localhost’,
1 => ‘50.60.100.101’,
2 => ‘192.168.0.2’,
),

Snippet from /var/log/apache2/access.log:
50.60.100.101 - - [11/Jun/2019:23:12:48 -0500] “GET /nextcloud/ HTTP/1.1” 400 12667 “-” “Mozilla/5.0 (Linux; Android 9; Pixel 2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.67 Mobile Safari/537.36”

Re-verified trusted domains:
user@xxx: /var/www/html/nextcloud$ sudo -u www-data php occ config:system:get trusted_domains
localhost
50.60.100.101
192.168.0.2

My Access through untrusted domain doesn’t list the IP/domain, otherwise I’d try adding that to the list.

Is there anything else I can try or investigate?

The parameter didn’t define from which ip address you access the server, but the fqdn you use in the url to access the server. So if you e.g. use “https://nextcloud.domain.com” to access Nextcloud, you have to add “nextcloud.domain.com” to the list.

Yes, that’s what I’m doing, I have the IP address I’m using in my URL in my trusted_domains list. I posted a bad example because at the time I was VPNed into my server. When I’m not VPNed, I have the same problem.

Is there a way to display the untrusted_domain on the Access through untrusted domain page?

the URL of your trusted domain is missing in here… i mean you should set it up in config.php

In my browser I go to https://50.60.100.101/nextcloud (the external IP) and I get the Access through untrusted domain page even though 50.60.100.101 is in the config.php.

Is there a way to display the untrusted_domain on the Access through untrusted domain page?

Funny, may be you have some rewrite rules in Apache, so that nextcloud does not see correct domain?

Or do you have Virtualhost “50.60.100.101” configured in Apache? Or you just save nextcloud config of folder “nextcloud” and make it accessible for each domain?

Try to check NC logs under …/data/nextcloud.log if you have any hint there regarding domain. Interesting to see what kind of domain NC thinks you getting though.

I don’t know which PHP function Nextcloud uses internally, but you can try to create a file domtest.php with the following code and place it in the Nextcloud root. Then you call it in your browser by using the url https://50.60.100.101/nextcloud/domtest.php.

<?php
echo ">".$_SERVER['HTTP_HOST']."<\n";
?>

I figured out my problem, very dumb. I had nextcloud in two places, /var/www/html/nextcloud/ and /var/www/nextcloud/ and I was editing the wrong config file. I must not have cleaned up things when I was installing it.

Thanks for all the suggestions.

1 Like

I suppose to ask this, but… did not expect 2 NCs installations :grin: