Access of Nextcloud via LAN and Internet

I have Nextcloud setup on a unRAID server running as a docker installation. It is sitting behind a nginx reverse proxy.

My issues is, when I upload documents to my Nextcloud instance, while still on my LAN where Nextcloud is also hosted, it will still upload via the Internet.

I am sure it is possible to setup a config somewhere, either nginx or in Nextcloud, so it can recognize connections from the LAN or Internet.

The following is my nginx conf:

##########################################################
# LOGS
##########################################################
access_log /config/log/nginx/access.log;
error_log /config/log/nginx/error.log;

##########################################################
# REVERSE PROXY APP
##########################################################

server {
	listen 443 ssl default_server;	
	listen 80 default_server;
	root /config/www;
	index index.html index.htm index.php;

    server_name mydomain.org;

	ssl_certificate /config/keys/letsencrypt/fullchain.pem;
	ssl_certificate_key /config/keys/letsencrypt/privkey.pem;
	ssl_dhparam /config/nginx/dhparams.pem;
	ssl_protocols TLSv1.2;
	ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
	ssl_prefer_server_ciphers on;

	client_max_body_size 20M;

   	}

		location /nextcloud {
		auth_basic off;
		include /config/nginx/proxy.conf;
		proxy_pass https://192.168.1.107:444/nextcloud;
	}
	
	
	location ~ /netdata/(?<ndpath>.*) {
		proxy_set_header X-Forwarded-Host $host;
		proxy_set_header X-Forwarded-Server $host;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_pass http://backend/$ndpath$is_args$args;
		proxy_http_version 1.1;
		proxy_pass_request_headers on;
		proxy_set_header Connection "keep-alive";
		proxy_store off;
	}
}

This is my Nextcloud config, where I think the problem might be located.

<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/data',
  'trusted_domains' => 
  array (
    0 => '192.168.1.107:444/nextcloud',
    1 => 'mydomain.org',
  ),
  'overwrite.cli.url' => 'https://mydomain.org',
  'overwritehost' => 'mydomain.org',
  'overwriteprotocol' => 'https',
  'instanceid' => '',
  'passwordsalt' => '/',
  'secret' => '',
  'dbtype' => '',
  'version' => '12.0.0.29',
  'dbname' => '',
  'dbhost' => '',
  'dbport' => '',
  'dbtableprefix' => '',
  'dbuser' => '',
  'dbpassword' => '',
  'installed' => true,
);

Any ideas/help would be appreciated

Do you have internal DNS? If so you can override the internet hostname to point to your local IP.
These are the reason:

They effectively force NC to use the external URL.

I use duckdns to map to my external IP, so this is what this part is for. I had a feeling it would be this. Would you happen to know if there is a way to configure this to only apply to connections outside my LAN?

I don’t personally as I’ve not needed to look into it. I’ve got split DNS at home so while my configuration is the same as yours, my DNS server points the URL to my proxy internally while I’m on the LAN.