You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Config Param 'overwritecondaddr' not working #6914
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:
dots are not escaped. Please have a second look at the doc
/**
* This option allows you to define a manual override condition as a regular
* expression for the remote IP address. For example, defining a range of IP
* addresses starting with ``10.0.0.`` and ending with 1 to 3:
* ``^10\.0\.0\.[1-3]$``
/**
* Returns the overwritehost setting from the config if set and
* if the overwrite condition is met
* @return string|null overwritehost value or null if not defined or the defined condition
* isn't met
*/
private function getOverwriteHost() {
if($this->config->getSystemValue('overwritehost') !== '' && $this->isOverwriteCondition()) {
return $this->config->getSystemValue('overwritehost');
}
return null;
}
always returns the configured value and so hostname replacement always takes place. Even if it should not be the case.
what @ghmax described, $this->isOverwriteCondition() will ALWAYS return True
at least in my configuration (very similar to the above, using the docker container nextcloud:latest (currently version 13.0.5, and an nginx reverse proxy) $this->server['REMOTE_ADDR'] always seems to contain the IP of the client, even if it was routed via the proxy. This means that preg_match($regex, $remoteAddr) === 1 will always be False for me
I could try to come up with a patch, but I'm not sure how this could be fixed. The easiest solution could be to change how overwritecondaddr works (or introduce a new config parameter), in a sense that the new/changed parameter should be a regex for the ips that either should or should not be overwritten (i.e. e.g. LAN (do not overwrite) or WAN (do overwrite)), but this would require everybody who uses this to reconfigure their nextcloud installation -- probably something that is not appreciated :-)
@danielwbn you can simply drop || $type !== 'protocol'. It was a left over when the forcessl option was removed, which was an essential part of that check. It should all have gone.
Activity
blizzz commentedon Oct 24, 2017
dots are not escaped. Please have a second look at the doc
Does it help?
ghmax commentedon Oct 24, 2017
Hello,
no - that does not help. I already 'dotted' the
'overwritecondaddr' => '^192\.168\.99\.11$',Look at the code in https://github.com/nextcloud/server/blob/master/lib/private/AppFramework/Http/Request.php -- there is the expression: $this->isOverwriteCondition() with empty params within getOverwriteHost() -- which always returns true - what is not what we should expect... (in my understanding)
so a call to:
always returns the configured value and so hostname replacement always takes place. Even if it should not be the case.
blizzz commentedon Oct 25, 2017
@LukasReschke ^
mxvin commentedon Feb 13, 2018
Alright then, can anybody make some hotfixes according this bugs? ;)
danielwbn commentedon Aug 28, 2018
I think two things need to be fixed here:
I could try to come up with a patch, but I'm not sure how this could be fixed. The easiest solution could be to change how overwritecondaddr works (or introduce a new config parameter), in a sense that the new/changed parameter should be a regex for the ips that either should or should not be overwritten (i.e. e.g. LAN (do not overwrite) or WAN (do overwrite)), but this would require everybody who uses this to reconfigure their nextcloud installation -- probably something that is not appreciated :-)
blizzz commentedon Aug 28, 2018
@danielwbn you can simply drop
|| $type !== 'protocol'. It was a left over when the forcessl option was removed, which was an essential part of that check. It should all have gone.kylemart commentedon Feb 17, 2020
I'm surprised this hasn't been addressed already. Is anyone working on this, or should I take a swing at it?
blizzz commentedon Feb 27, 2020
Please :)
Petersoj commentedon Feb 14, 2021
+1
I sometimes want to access my Nextcloud instance on my LAN instead of through my reverse proxy!
10 remaining items
Nihlus commentedon Mar 18, 2023
gulyo commentedon Apr 24, 2023
Hey All,
I confirm the issue exists in 26.0.1.1
IngLP commentedon Jul 14, 2023
+1. The issue still exists also in NC 27!
IngLP commentedon Oct 10, 2023
I still have this issue!
fixing bug #6914: Config Param 'overwritecondaddr' not working
fixing bug #6914: Config Param 'overwritecondaddr' not working
fixing bug #6914: Config Param 'overwritecondaddr' not working
fixing bug #6914: Config Param 'overwritecondaddr' not working
fixing bug #6914: Config Param 'overwritecondaddr' not working
fixing bug #6914: Config Param 'overwritecondaddr' not working