mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-05 08:04:09 +01:00
* [MOD] Improved regex for retrieving ip addresses through reverse proxy.
This commit is contained in:
@@ -113,14 +113,18 @@ class HttpUtil
|
||||
*/
|
||||
public static function getForwardedFor()
|
||||
{
|
||||
if (preg_match_all('/for=([0-9\.]+)[,;]+/i',
|
||||
if (preg_match_all('/for=["\[]*([\w.:]+)["\]]*[,;]?/i',
|
||||
Request::getRequestHeaders('HTTP_FORWARDED'), $matchesFor)) {
|
||||
return $matchesFor[1];
|
||||
}
|
||||
|
||||
if (preg_match_all('/([\w.:]+)(,|$)/',
|
||||
Request::getRequestHeaders('HTTP_X_FORWARDED_FOR'), $matchesFor)) {
|
||||
return $matchesFor[1];
|
||||
$matchesFor = preg_split('/(?<=[\w])+,/i',
|
||||
Request::getRequestHeaders('HTTP_X_FORWARDED_FOR'),
|
||||
-1,
|
||||
PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
if (count($matchesFor) > 0) {
|
||||
return $matchesFor;
|
||||
}
|
||||
|
||||
return $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
@@ -386,7 +386,7 @@ class Util
|
||||
*/
|
||||
public static function getVersion($retBuild = false, $normalized = false)
|
||||
{
|
||||
$build = 17091802;
|
||||
$build = 17091803;
|
||||
$version = [2, 1, 15];
|
||||
|
||||
if ($normalized === true) {
|
||||
|
||||
Reference in New Issue
Block a user