Unable to Upload behind reverse proxy

Hi,

i do have some problems with Nextcloud. We use the pre-configured image from Hanssonit, unfortunately i am unable to upload files when the server is behind a reverse proxy.

Nextcloud version (eg, 12.0.2): 16.0.1
Operating system and version (eg, Ubuntu 17.04): Ubuntu 18.04.2 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.29
PHP version (eg, 7.1): **PHP 7.2.15-0ubuntu0.18.04.1 **

The issue you are facing: Unable to Upload Files in Browser or Windows 10 Client when connected through reverse Proxy (Sophos UTM Firewall). If connected through Local IP, Upload works withouth errors.

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

Steps to replicate it:

  1. Configured Hanssonit 40gb Cloud
  2. Setup reverse Proxy with SSL on Sophos UTM
  3. Trying to Upload Files

The output of your Nextcloud log in Admin > Logging:

[webdav] Debug: Sabre\DAV\Exception\NotFound: File with name //568653.jpg could not be located at <<closure>>

 0. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 76
    OCA\DAV\Connector\Sabre\Directory->getChild("568653.jpg")
 1. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 967
    Sabre\DAV\Tree->getNodeForPath("files/Nextadmin/568653.jpg")
 2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1666
    Sabre\DAV\Server->getPropertiesIteratorForPath("files/Nextadmin/568653.jpg", ["{DAV:}getlastm ... "], 0)
 3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 355
    Sabre\DAV\Server->generateMultiStatus(Generator {}, false)
 4. <<closure>>
    Sabre\DAV\CorePlugin->httpPropFind(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 5. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    undefinedundefinedcall_user_func_array([Sabre\DAV\CorePlugin {},"httpPropFind"], [Sabre\HTTP\Requ ... }])
 6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    Sabre\Event\EventEmitter->emit("method:PROPFIND", [Sabre\HTTP\Requ ... }])
 7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 8. /var/www/nextcloud/apps/dav/lib/Server.php line 316
    Sabre\DAV\Server->exec()
 9. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
10. /var/www/nextcloud/remote.php line 163
    undefinedundefinedrequire_once("/var/www/nextcl ... p")

PROPFIND /remote.php/dav/files/Nextadmin/568653.jpg
from 192.168.230.1 by Nextadmin at 2019-06-17T13:21:48+00:00

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

<?php
$CONFIG = array (
  'passwordsalt' => 'xxxx',
  'secret' => 'xxxx',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'cloud.myCompany.de',
    2 => 'myCompany.de',
    3 => '*',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '16.0.1.1',
  'trusted_proxies' => '192.168.230.1',
  'overwrite.cli.url' => 'https://cloud.myCompany.de/',
  'overwritewebroot' => '/',
  'overwritehost' => 'cloud.myCompany.de',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'xxxx',
  'dbpassword' => 'xxxx',
  'installed' => true,
  'instanceid' => 'xxxx',
  'mail_smtpmode' => 'smtp',
  'remember_login_cookie_lifetime' => '1800',
  'log_rotate_size' => '10485760',
  'simpleSignUpLink.shown' => 'false',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.5,
    'dbindex' => 0,
    'password' => 'xxxx',
  ),
  'htaccess.RewriteBase' => '/',
  'maintenance' => false,
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'updater.secret' => 'xxxx',
  'theme' => '',
  'loglevel' => 0,
);

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


  GNU nano 2.9.3                                                                                                     error.log

[Mon Jun 17 06:25:07.847950 2019] [ssl:warn] [pid 28675:tid 140358911822784] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 06:25:07.858266 2019] [mpm_event:notice] [pid 28675:tid 140358911822784] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.0g configured -- resuming normal operations
[Mon Jun 17 06:25:07.858286 2019] [core:notice] [pid 28675:tid 140358911822784] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jun 17 08:44:29.497448 2019] [mpm_event:notice] [pid 28675:tid 140358911822784] AH00491: caught SIGTERM, shutting down
[Mon Jun 17 08:44:29.634496 2019] [ssl:warn] [pid 22445:tid 140254135184320] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 08:44:29.646685 2019] [ssl:warn] [pid 22460:tid 140254135184320] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 08:44:29.648186 2019] [mpm_event:notice] [pid 22460:tid 140254135184320] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.0g configured -- resuming normal operations
[Mon Jun 17 08:44:29.648208 2019] [core:notice] [pid 22460:tid 140254135184320] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jun 17 08:58:37.436788 2019] [mpm_event:notice] [pid 22460:tid 140254135184320] AH00491: caught SIGTERM, shutting down
[Mon Jun 17 08:58:37.500147 2019] [ssl:warn] [pid 23022:tid 140027838270400] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 08:58:37.508572 2019] [ssl:warn] [pid 23038:tid 140027838270400] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 08:58:37.509787 2019] [mpm_event:notice] [pid 23038:tid 140027838270400] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.0g configured -- resuming normal operations
[Mon Jun 17 08:58:37.509809 2019] [core:notice] [pid 23038:tid 140027838270400] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jun 17 09:43:36.254836 2019] [mpm_event:notice] [pid 23038:tid 140027838270400] AH00491: caught SIGTERM, shutting down
[Mon Jun 17 09:43:36.321437 2019] [ssl:warn] [pid 25300:tid 140420734307264] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 09:43:36.332090 2019] [ssl:warn] [pid 25318:tid 140420734307264] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 09:43:36.333512 2019] [mpm_event:notice] [pid 25318:tid 140420734307264] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.0g configured -- resuming normal operations
[Mon Jun 17 09:43:36.333533 2019] [core:notice] [pid 25318:tid 140420734307264] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jun 17 09:46:04.653627 2019] [mpm_event:notice] [pid 25318:tid 140420734307264] AH00491: caught SIGTERM, shutting down
[Mon Jun 17 09:46:04.714897 2019] [ssl:warn] [pid 25600:tid 140112740170688] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 09:46:04.723260 2019] [ssl:warn] [pid 25615:tid 140112740170688] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 09:46:04.724476 2019] [mpm_event:notice] [pid 25615:tid 140112740170688] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.0g configured -- resuming normal operations
[Mon Jun 17 09:46:04.724499 2019] [core:notice] [pid 25615:tid 140112740170688] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jun 17 11:42:15.558170 2019] [mpm_event:notice] [pid 25615:tid 140112740170688] AH00491: caught SIGTERM, shutting down
[Mon Jun 17 11:42:15.668030 2019] [ssl:warn] [pid 35331:tid 140221372632000] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 11:42:15.681192 2019] [ssl:warn] [pid 35344:tid 140221372632000] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 11:42:15.682762 2019] [mpm_event:notice] [pid 35344:tid 140221372632000] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.0g configured -- resuming normal operations
[Mon Jun 17 11:42:15.682794 2019] [core:notice] [pid 35344:tid 140221372632000] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jun 17 11:42:53.150460 2019] [mpm_event:notice] [pid 35344:tid 140221372632000] AH00491: caught SIGTERM, shutting down
[Mon Jun 17 11:42:53.216290 2019] [ssl:warn] [pid 35551:tid 140709913267136] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 11:42:53.229165 2019] [ssl:warn] [pid 35555:tid 140709913267136] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 11:42:53.230532 2019] [mpm_event:notice] [pid 35555:tid 140709913267136] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.0g configured -- resuming normal operations
[Mon Jun 17 11:42:53.230561 2019] [core:notice] [pid 35555:tid 140709913267136] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jun 17 13:31:14.955503 2019] [mpm_event:notice] [pid 35555:tid 140709913267136] AH00491: caught SIGTERM, shutting down
[Mon Jun 17 13:31:15.054061 2019] [ssl:warn] [pid 39798:tid 140181567126464] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 13:31:15.067828 2019] [ssl:warn] [pid 39812:tid 140181567126464] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 13:31:15.068927 2019] [mpm_event:notice] [pid 39812:tid 140181567126464] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.0g configured -- resuming normal operations
[Mon Jun 17 13:31:15.068950 2019] [core:notice] [pid 39812:tid 140181567126464] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jun 17 15:18:47.987566 2019] [core:warn] [pid 39812:tid 140181567126464] AH00045: child process 39816 still did not exit, sending a SIGTERM
[Mon Jun 17 15:18:49.989401 2019] [core:warn] [pid 39812:tid 140181567126464] AH00045: child process 39816 still did not exit, sending a SIGTERM
[Mon Jun 17 15:18:50.990654 2019] [mpm_event:notice] [pid 39812:tid 140181567126464] AH00491: caught SIGTERM, shutting down
[Mon Jun 17 15:18:51.069868 2019] [ssl:warn] [pid 44908:tid 140055944670144] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 15:18:51.078665 2019] [ssl:warn] [pid 44923:tid 140055944670144] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Jun 17 15:18:51.080002 2019] [mpm_event:notice] [pid 44923:tid 140055944670144] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.0g configured -- resuming normal operations
[Mon Jun 17 15:18:51.080034 2019] [core:notice] [pid 44923:tid 140055944670144] AH00094: Command line: '/usr/sbin/apache2'


Thanks in advance for any help.

Regards,
Jonathan