Overwritecondaddr option for reverse proxy environment

expert
oc-internals
9.1.x

#1

I'm trying to support multi-access to owncloud. Via reverse proxy from WAN and direct access from LAN. The option, overwritecondaddr can be used to achieve it?

https://doc.owncloud.org/server/9.1/admin_manual/configuration_server/reverse_proxy_configuration.html
The document says

The overwritecondaddr parameter is used to overwrite the values dependent on the remote address.

But, in ./lib/private/AppFramework/Http/Request.php, isOverwriteCondition always returns TRUE except for being called by getServerProtocol, whatever overwritecondaddr is specified. Other functions doesn't specify type and isOverwriteCondition returns TRUE.

527         private function isOverwriteCondition($type = '') {
528                 $regex = '/' . $this->config->getSystemValue('overwritecondaddr', '')  . '/';
529                 $remoteAddr = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : '';
530                 return $regex === '//' || preg_match($regex, $remoteAddr) === 1
531                 || $type !== 'protocol';
532         }
...
539         public function getServerProtocol() {
540                 if($this->config->getSystemValue('overwriteprotocol') !== ''
541                         && $this->isOverwriteCondition('protocol')) {
542                         return $this->config->getSystemValue('overwriteprotocol');
543                 }
...
594         public function getRequestUri() {
595                 $uri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : '';
596                 if($this->config->getSystemValue('overwritewebroot') !== '' && $this->isOverwriteCondition()) {
597                         $uri = $this->getScriptName() . substr($uri, strlen($this->server['SCRIPT_NAME']));
598                 }
...
676         public function getScriptName() {
677                 $name = $this->server['SCRIPT_NAME'];
678                 $overwriteWebRoot =  $this->config->getSystemValue('overwritewebroot');
679                 if ($overwriteWebRoot !== '' && $this->isOverwriteCondition()) {
680                         // FIXME: This code is untestable due to __DIR__, also that hardcoded path is really dangerous
681                         $serverRoot = str_replace('\\', '/', substr(__DIR__, 0, -strlen('lib/private/appframework/http/')));
682                         $suburi = str_replace('\\', '/', substr(realpath($this->server['SCRIPT_FILENAME']), strlen($serverRoot)));
683                         $name = '/' . ltrim($overwriteWebRoot . $suburi, '/');
684                 }
...
767         private function getOverwriteHost() {
768                 if($this->config->getSystemValue('overwritehost') !== '' && $this->isOverwriteCondition()) {
769                         return $this->config->getSystemValue('overwritehost');
770                 }
771                 return null;
772         }

Should we comment out line 531?

Thanks,