xiang 6 年之前
父节点
当前提交
3643298da6
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      vendor/GatewayWorker_linux/GatewayWorker/Applications/whisper/start_gateway.php

+ 6 - 0
vendor/GatewayWorker_linux/GatewayWorker/Applications/whisper/start_gateway.php

@@ -89,6 +89,12 @@ $gateway->onConnect = function ($connection) {
         }
         $_SESSION['remotip'] = isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $connection->getRemoteIp();
         $_SESSION['remotport'] = $connection->getRemotePort();
+        //cdn处理
+        $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
+        if (isset($ips[0])  && $ips[0]) { } else {
+            $_SESSION['remotip'] = $ips[0];
+        }
+        //cdn处理
         $_SERVER['REMOTE_ADDR'] = $_SESSION['remotip'];