Description
openedon Oct 23, 2017
Steps to reproduce
- clean install nextcloud
- add conditional overwrite settings to config.php
'overwritehost' => 'my.domain.com',
'overwritecondaddr' => '^192.168.0.1$',
Expected behaviour
Hostname should be overwritten when request comes in via 192.168.0.1, otherwise NOT.
Actual behaviour
Hostname is always overwritten
Server configuration
Operating system:
official Docker Image on different Docker Hosts
Nextcloud version: (see Nextcloud admin page)
12.0.3.3
Updated from an older Nextcloud/ownCloud or fresh install:
fresh
Where did you install Nextcloud from:
docker
Nextcloud configuration:
Config report
<?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
'instanceid' => 'xxx',
'passwordsalt' => 'xxx',
'secret' => 'xxx',
'trusted_domains' =>
array (
0 => '192.168.99.100:9000',
),
'datadirectory' => '/var/www/html/data',
'overwrite.cli.url' => 'http://192.168.99.100:9000',
'dbtype' => 'sqlite3',
'version' => '12.0.3.3',
'installed' => true,
'overwritecondaddr' => '^192\.168\.99\.11$',
'overwritehost' => 'my.domain.com',
);
Code causing Troubles...
Problem is in File .../lib/private/AppFramework/Http/Request.php in Method 'private function isOverwriteCondition($type = '')' ... type is empty when checking for e.g. Host-Override in Method 'getOverwriteHost' ... so with empty type check override method (isOverwriteCondition) always returns true cause of:
...
return $regex === '//' || preg_match($regex, $remoteAddr) === 1 || $type !== 'protocol';
...
-> type === '' ... so $type !== 'protocol' is always true ... so method always returns true in this case.