Share links passing local IP [SOLVED]

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 18.0.2): 18.01=
Operating system and version (eg, Ubuntu 20.04):20.04
Apache or nginx version (eg, Apache 2.4.25): Nginx 1.16.1
PHP version (eg, 7.1):

The issue you are facing:
When you create an external share link it makes a URL with my domain but when you attempt to download or play the media it passes the local IP address. I can change it the incorrectly passed local ip to the domain it works fine

Is this the first time you’ve seen this error? (Y/N):

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:

Level
App	Message		Time
Warning	core	imagecreatefrombmp: imagecreatetruecolor failed for file "/var/snap/nextcloud/common/nextcloud/data/killerherts/files/size_after.bmp" with dimensions 200x4294967193		2020-06-03T21:02:02-0700
Error	PHP	imagecreatetruecolor(): Invalid image dimensions at /snap/nextcloud/21026/htdocs/lib/private/legacy/image.php#749		2020-06-03T21:02:02-0700
Error	PHP	Invalid argument supplied for foreach() at /snap/nextcloud/21026/htdocs/apps/serverinfo/lib/Os.php#155		2020-06-03T20:58:51-0700
Error	PHP	Undefined variable: result at /snap/nextcloud/21026/htdocs/apps/serverinfo/lib/OperatingSystems/DefaultOs.php#173		2020-06-03T20:58:51-0700
Error	PHP	Invalid argument supplied for foreach() at /snap/nextcloud/21026/htdocs/apps/serverinfo/templates/settings-admin.php#101		2020-06-03T20:58:50-0700
Error	PHP	Undefined variable: result at /snap/nextcloud/21026/htdocs/apps/serverinfo/lib/OperatingSystems/DefaultOs.php#173		2020-06-03T20:58:49-0700
Warning	core	imagecreatefrombmp: imagecreatetruecolor failed for file "/var/snap/nextcloud/common/nextcloud/data/killerherts/files/size_after.bmp" with dimensions 200x4294967193		2020-06-03T20:58:37-0700
Error	PHP	imagecreatetruecolor(): Invalid image dimensions at /snap/nextcloud/21026/htdocs/lib/private/legacy/image.php#749		2020-06-03T20:58:37-0700
Warning	core	imagecreatefrombmp: imagecreatetruecolor failed for file "/var/snap/nextcloud/common/nextcloud/data/killerherts/files/size_after.bmp" with dimensions 200x4294967193		2020-06-03T20:58:16-0700
Error	PHP	imagecreatetruecolor(): Invalid image dimensions at /snap/nextcloud/21026/htdocs/lib/private/legacy/image.php#749		2020-06-03T20:58:16-0700
Warning	core	imagecreatefrombmp: imagecreatetruecolor failed for file "/var/snap/nextcloud/common/nextcloud/data/killerherts/files/size_after.bmp" with dimensions 200x4294967193		2020-06-03T20:52:33-0700
Error	PHP	imagecreatetruecolor(): Invalid image dimensions at /snap/nextcloud/21026/htdocs/lib/private/legacy/image.php#749		2020-06-03T20:52:33-0700
Error	lib	ResourceLocator can not find a web root (root: /var/snap/nextcloud/21026/nextcloud/extra-apps/calendar, file: index.php/css/calendar/a2fe-b026-calendar.css?v=d41d8cd98f00b204e9800998ecf8427e, webRoot: , throw: true)		2020-06-03T19:52:01-0700
Error	PHP	opendir(/home/killerherts/Plex/): failed to open dir: Permission denied at /snap/nextcloud/21026/htdocs/lib/private/Files/Storage/Local.php#127		2020-06-02T10:04:39-0700
Error	PHP	opendir(/home/killerherts/Plex/): failed to open dir: Permission denied at /snap/nextcloud/21026/htdocs/lib/private/Files/Storage/Local.php#127		2020-06-02T09:59:27-0700
Error	PHP	opendir(/home/killerherts/Plex/): failed to open dir: Permission denied at /snap/nextcloud/21026/htdocs/lib/private/Files/Storage/Local.php#127		2020-06-02T09:45:19-0700
Error	ocs_api	Swift_TransportException: Connection could not be established with host 127.0.0.1 :stream_socket_client(): unable to connect to 127.0.0.1:25 (Connection refused)		2020-06-02T09:37:51-0700
Error	ocs_api	Swift_TransportException: Connection could not be established with host 127.0.0.1 :stream_socket_client(): unable to connect to 127.0.0.1:25 (Connection refused)		2020-06-02T09:31:39-0700
Warning	ocs_api	OC\HintException: Password is among the 1,000,000 most common ones. Please make it unique.		2020-06-02T09:31:21-0700
Warning	no app in context	Login failed: *@gmail.com (Remote IP: 192.168.1.168)		2020-06-02T09:18:44-0700
Warning	no app in context	Login failed: *@gmail.com (Remote IP: 192.168.1.168)		2020-06-02T09:12:32-0700

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

<?php
$CONFIG = array (
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' => 
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'instanceid' => 'ocugdv02cryh',
  'passwordsalt' => '*',
  'secret' => '*',
  'trusted_domains' => 
  array (
    0 => 'cloud.xxx.club',
    1 => '192.168.1.168:81',
  ),
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '18.0.4.2',
  'overwrite.cli.url' => 'https://cloud.lightmedia.club',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '*-*',
  'installed' => true,
  'maintenance' => false,
);

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

2020/06/03 19:45:50 [error] 939#939: *9219 client intended to send too large body: 3472108 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/01-A%20Greater%20God.mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:03 [error] 939#939: *9377 client intended to send too large body: 4862617 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/06-I'm%20Going%20Straight%20To%20Heaven.mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:12 [error] 939#939: *9396 client intended to send too large body: 6828340 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/05-Shut%20Up.mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:18 [error] 939#939: *9393 client intended to send too large body: 7786744 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/08-Talking%20To%20The%20Spirits.mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:26 [error] 939#939: *9385 client intended to send too large body: 6810735 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/03-Truth%20Is%20Out%20Of%20Style.mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:27 [error] 939#939: *9410 client intended to send too large body: 5221933 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/02-Real%20Black%20Angel.mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:31 [error] 939#939: *9411 client intended to send too large body: 8276678 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/07-Spaceman.mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:32 [error] 939#939: *9405 client intended to send too large body: 6663595 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/09-Too%20Bad.mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:33 [error] 939#939: *9413 client intended to send too large body: 6405205 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/04-UFOs%20Are%20Real.mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:41 [error] 939#939: *9420 client intended to send too large body: 6855839 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/11-Born%20With%20Monkey%20Asses.mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:43 [error] 939#939: *9416 client intended to send too large body: 4879531 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/12-Straight%20To%20Heaven%20(Instrumental).mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:52 [error] 939#939: *9426 client intended to send too large body: 7355891 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/13-UFOs%20Are%20Real%20(Exhibit%20B).mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:46:58 [error] 939#939: *9429 client intended to send too large body: 7177518 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/14-Truth%20Is%20Out%20Of%20Style%20(12''%20Mix).mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:47:05 [error] 939#939: *9431 client intended to send too large body: 10485760 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/dav/uploads/Jamie/web-file-upload-8f7b5ee75c1193965a17f56912f76e1a-1591238748670/0 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:47:08 [error] 939#939: *9436 client intended to send too large body: 10485760 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/dav/uploads/Jamie/web-file-upload-234bd84da78a4602386a413eedbdd980-1591238748670/0 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:48:57 [error] 939#939: *9507 client intended to send too large body: 2829211 bytes, client: 162.158.255.227, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/kids%20room-100524-100530.mp4 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 19:56:20 [error] 939#939: *9913 client intended to send too large body: 3472108 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/webdav/Jamie_Music/1/01-A%20Greater%20God.mp3 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 20:11:08 [error] 939#939: *10426 client intended to send too large body: 10485760 bytes, client: 172.69.68.60, server: cloud.lightmedia.club, request: "PUT /remote.php/dav/uploads/Jamie/web-file-upload-04e7b2aaf922289b9b2fe0c738293be3-1591240265367/0 HTTP/1.1", host: "cloud.lightmedia.club"
2020/06/03 20:20:25 [error] 939#939: *10632 upstream prematurely closed connection while reading upstream, client: 172.68.141.187, server: cloud.lightmedia.club, request: "GET /index.php/s/r4QD9MqTLXPgRmW/download HTTP/1.1", upstream: "http://192.168.1.168:81/index.php/s/r4QD9MqTLXPgRmW/download", host: "cloud.lightmedia.club"
2020/06/03 20:30:20 [error] 939#939: *10841 connect() failed (111: Connection refused) while connecting to upstream, client: 172.68.142.236, server: cloud.lightmedia.club, request: "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1", upstream: "http://192.168.1.168:81/ocs/v2.php/apps/notifications/api/v2/notifications", host: "cloud.lightmedia.club"
2020/06/03 20:30:26 [error] 939#939: *10852 connect() failed (111: Connection refused) while connecting to upstream, client: 172.68.142.236, server: cloud.lightmedia.club, request: "POST /index.php/apps/text/session/sync HTTP/1.1", upstream: "http://192.168.1.168:81/index.php/apps/text/session/sync", host: "cloud.lightmedia.club"
2020/06/03 20:36:41 [error] 939#939: *10948 connect() failed (111: Connection refused) while connecting to upstream, client: 172.68.142.236, server: cloud.lightmedia.club, request: "POST /index.php/apps/text/session/sync HTTP/1.1", upstream: "http://192.168.1.168:81/index.php/apps/text/session/sync", host: "cloud.lightmedia.club"
2020/06/03 20:40:58 [error] 939#939: *11259 connect() failed (111: Connection refused) while connecting to upstream, client: 172.68.141.7, server: cloud.lightmedia.club, request: "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1", upstream: "http://192.168.1.168:81/ocs/v2.php/apps/notifications/api/v2/notifications", host: "cloud.lightmedia.club"
2020/06/03 20:45:07 [error] 939#939: *11013 connect() failed (111: Connection refused) while connecting to upstream, client: 172.68.142.236, server: cloud.lightmedia.club, request: "POST /index.php/apps/text/session/sync HTTP/1.1", upstream: "http://192.168.1.168:81/index.php/apps/text/session/sync", host: "cloud.lightmedia.club"
2020/06/03 20:45:11 [error] 939#939: *11346 connect() failed (111: Connection refused) while connecting to upstream, client: 162.158.126.119, server: cloud.lightmedia.club, request: "GET / HTTP/1.1", upstream: "http://192.168.1.168:81/", host: "cloud.lightmedia.club"
2020/06/03 20:45:12 [error] 939#939: *11348 connect() failed (111: Connection refused) while connecting to upstream, client: 162.158.126.127, server: cloud.lightmedia.club, request: "GET /favicon.ico HTTP/1.1", upstream: "http://192.168.1.168:81/favicon.ico", host: "cloud.lightmedia.club"
2020/06/03 20:45:13 [error] 939#939: *11350 connect() failed (111: Connection refused) while connecting to upstream, client: 172.68.142.236, server: cloud.lightmedia.club, request: "POST /index.php/apps/text/session/sync HTTP/1.1", upstream: "http://192.168.1.168:81/index.php/apps/text/session/sync", host: "cloud.lightmedia.club"
2020/06/03 20:47:10 [error] 939#939: *11380 connect() failed (111: Connection refused) while connecting to upstream, client: 172.68.142.236, server: cloud.lightmedia.club, request: "POST /index.php/apps/text/session/sync HTTP/1.1", upstream: "http://192.168.1.168:81/index.php/apps/text/session/sync", host: "cloud.lightmedia.club"
2020/06/03 20:47:16 [error] 939#939: *11380 connect() failed (111: Connection refused) while connecting to upstream, client: 172.68.142.236, server: cloud.lightmedia.club, request: "POST /index.php/apps/text/session/sync HTTP/1.1", upstream: "http://192.168.1.168:81/index.php/apps/text/session/sync", host: "cloud.lightmedia.club"

The solution is adding ‘overwritehost’ => ‘example.com’, to your nextcloud config.php this will fix webdav and share links showing your local host address

I do not really understand your problem. I think if you share a link with your domain, but in a part of download the user switched to 192.168.1.168:81 and that does not work.

Can you look your network analysis in the browser (F12) and post some parts? Can you also post a screenshot? Perhaps you also can temporary delete "1 => ‘192.168.1.168:81’, in your config.php . Please look also in your apache2- and/or nginx configuration.


I am doing an awful job of explaining here is a visual. I created this share link but when you click the download link see the URL its passing is local instead of the domain. You would still need 192.168.1.168:81 in the trusted domain section even the local nextcloud page goes down
if you click navigate everything works as it should its just when you create share links that this happens