Access to Nextcloud via local network

Hi all
I am having an issue since a few days ago. I cannot access my Nextcloud deployment via local network (at home), but I can do it from outside via DNS I have set up.

When I am at home I cannot access neither via local IP (192.168.XXX.XXX) nor via DNS.

I have been reading a lot and saw similar probles but cannot make it work. Not sure if it is a network problem or a nextcloud config issue. I assume the second as I have a transmission server (different IP bur same server) that works properly.

My Nextcloud is deployed in a TRUENas environment in a jail. (Transmission in a different jail working).

Nextcloud version (eg, 20.0.5): 22.2.5
Operating system and version (eg, Ubuntu 20.04): truenas 12 (up to date)
Apache or nginx version (eg, Apache 2.4.25): Caddy.
PHP version (eg, 7.4): not sure about it but I think it does not impact.

The issue you are facing:
Since a few day ago I cannot access when I am connected in my local network. IN that scenario I cannot access nor via DNS, nor via local IP.

Is this the first time you’ve seen this error? (Y/N): It is happening since several weeks ago. It worked till then.

Steps to replicate it:

NA

In the log I see this error. Not sure if relevant:

dns_get_record(): DNS Query failed at /usr/local/www/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php#83

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'passwordsalt' => 'deleted',
  'secret' => 'deleted',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '###.deleted.es',
    2 => '192.168.1.4',
  ),
  'datadirectory' => '/mnt/files',
  'default_phone_region' => 'ES',
  'dbtype' => 'mysql',
  'version' => '22.2.5.1',
  'overwrite.cli.url' => 'http://###.deleted.es:22027/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'deleted',
  'installed' => true,
  'instanceid' => 'deleted',
  'logtimezone' => 'Europe/Madrid',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud.log',
  'loglevel' => '2',
  'logrotate_size' => '104847600',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'overwritehost' => ###.deleted.es:22027',
  'overwriteprotocol' => 'http',
  'htaccess.RewriteBase' => '/',
  'maintenance' => false,
  'theme' => '',
  'updater.secret' => 'deleted',
);

The output of your Apache/nginx/system log in /var/log/____:

In Caddy log I find this eror. not sure if relevant…

{"level":"error","ts":1646825108.9380422,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"write tcp 192.168.1.4:80->85.48.187.65:53497: write: broken pipe"}
{"level":"error","ts":1646825108.9381132,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"write tcp 192.168.1.4:80->85.48.187.65:53503: write: broken pipe"}
{"level":"error","ts":1646825680.0062444,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"write tcp 192.168.1.4:80->90.167.219.186:14741: write: broken pipe
"}
{"level":"error","ts":1646825680.0064754,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"write tcp 192.168.1.4:80->90.167.219.186:32625: write: broken pipe
"}
{"level":"error","ts":1646825680.0063226,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"write tcp 192.168.1.4:80->90.167.219.186:32632: write: broken pipe
"}
{"level":"info","ts":1646867149.3524263,"logger":"tls","msg":"cleaned up storage units"}

Thanks all!!

Hi,

I am not an expert on this, so please wait for others to reply, but I think you may need to add your local NAT static IP for the NextCloud Server under ‘trusted_domains’ => to allow nextcloud to accept your local login request.

Thanks.

Hi
Thanks for the answer.
That is what I have there:
192.168.1.4 is the internal IP included in trusted domains…

Thanks again!

If this log entries had been generated at the time, you tried to access the Nextcloud instance via local IP, the reverse proxy seemed to try to send the answers to an external ip-address - maybe yours?

To which ip-address does your DNS server point to, if you try to call your Nextcloud server via its URI?

Not pretty sure if that error is related to the problem. it seems to point IP from which I connected.

Related to second question I don’t get it properly… If I point from an external network to my dns, it points to the IP properly (it works). Problem is inside my LAN.
Thanks for your help.

Did you check the DNS-rebind settings in your router?

I would say it is ok too.