Unable to add an IP to trusted domains

Nextcloud version _22.2.5
Operating system and version _FreeBSD 12.2-RELEASE-p12 amd64
nginx version _1.20.2
PHP version _7.4
Nextcloud 22.2.5 is installed as a plugin on Truenas

Initially system was installed and worked on the local domain. When I added port forwarding I edited config.txt and added my actual domain name and it worked. Now I am setting up a reverse proxy and need to access Nextcloud by the IP but I am unable to access the server using server’s local IP

Steps to replicate it:

  1. Edited /usr/local/www/nextcloud/config/config.php
<?php
$CONFIG = array (
  'instanceid' => 'XXXXXXXXXXX',
  'passwordsalt' => 'XXXXXXXXX',
  'secret' => 'XXXXXXXXXXXXXXX',
  'trusted_domains' =>
  array (
    0 => 'nextcloud.mydomain.com',
    1 => 'mydomain.duckdns.org:8080',
    2 => '192.168.1.5',
  ),
  'datadirectory' => 
  1. Restarted webserver: service nginx restart
  2. http://192.168.1.5 returns " Access through untrusted domain"
  3. I also tried using OCC: occ config:system:set trusted_domains 2 --value=192.168.1.5
  4. occ config:system:get trusted_domains
nextcloud.mydomain.com
mydomain.duckdns.org:8080

The output of Nextcloud conf: cat /usr/local/www/nextcloud/config/config.php

<?php
$CONFIG = array (
  'instanceid' => 'XXXXXXXXXXX',
  'passwordsalt' => 'XXXXXXXXX',
  'secret' => 'XXXXXXXXXXXXXXX',
  'trusted_domains' =>
  array (
    0 => 'nextcloud.mydomain.com',
    1 => 'mydomain.duckdns.org:8080',
    2 => '192.168.1.5',
  ),
  'datadirectory' => 

I also performed full Truenas reboot without success. Configuration file looks totally okay but the system is refusing to work using an IP address.

Did you put any variable regarding your proxy in the config.php (overwritehost…)?

The error with the untrusted domain doesn’t show the untrusted domain? Perhaps it would be helpful to have a more detailed error message like Access through untrusted domain example.org.

I did not add proxy variables in the config.php. I am not there yet. My first step was to make sure Nexctloud host is accessible by the IP address.
Is there a way to pull this error specific messages from the log?
image

If you enable the warning level for the logs, you should get a warning:
https://github.com/nextcloud/server/blob/2ff0c972c98a14f4dbd81d7923b119770600918f/lib/base.php#L763-L799
(line 787)
and the hostname used should show up…

Thank you for the suggestion. I just realized that my log level was set to “debug” and despite that there is nothing related to hostname or any error related to that. I start to be confused :slight_smile: