]> git.mxchange.org Git - friendica.git/blobdiff - src/App/Request.php
Merge pull request #12311 from matthiasmoritz/event-details-do-not-render-correctly...
[friendica.git] / src / App / Request.php
index 43cabba856e513e76b39c0c4f7df14e491251e7a..71b6a9ea3f088f4d160c76ccde3253a69979ff08 100644 (file)
@@ -32,8 +32,12 @@ use Friendica\Core\Config\Capability\IManageConfigValues;
  */
 class Request
 {
-       /** @var string the default possible headers, which could contain the client IP */
-       const ORDERED_FORWARD_FOR_HEADER = 'HTTP_X_FORWARDED_FOR';
+       /**
+        * A comma separated list of default headers that could contain the client IP in a proxy request
+        *
+        * @var string
+        */
+       const DEFAULT_FORWARD_FOR_HEADER = 'HTTP_X_FORWARDED_FOR';
 
        /** @var string The remote IP address of the current request */
        protected $remoteAddress;
@@ -108,7 +112,7 @@ class Request
         * specified in this header will be returned instead.
         *
         * @param IManageConfigValues $config
-        * @param array               $server
+        * @param array               $server The $_SERVER array
         *
         * @return string
         */
@@ -118,7 +122,7 @@ class Request
                $trustedProxies = preg_split('/(\s*,*\s*)*,+(\s*,*\s*)*/', $config->get('proxy', 'trusted_proxies', ''));
 
                if (\is_array($trustedProxies) && $this->isTrustedProxy($trustedProxies, $remoteAddress)) {
-                       $forwardedForHeaders = preg_split('/(\s*,*\s*)*,+(\s*,*\s*)*/', $config->get('proxy', 'forwarded_for_headers')) ?? static::ORDERED_FORWARD_FOR_HEADER;
+                       $forwardedForHeaders = preg_split('/(\s*,*\s*)*,+(\s*,*\s*)*/', $config->get('proxy', 'forwarded_for_headers', static::DEFAULT_FORWARD_FOR_HEADER));
 
                        foreach ($forwardedForHeaders as $header) {
                                if (isset($server[$header])) {