Closed ghost closed 5 years ago
php --ri swoole
php -v
Details 经过nginx代理转发后,即便配置了remote_ip等参数, $server->getClientInfo($frame->fd)['remote_ip'] 获取到的IP地址依旧是127.0.0.1,所有$server参数都看过了。。。获取不了,麻烦帮忙看看!
修改nginx.conf之类的各种方式都已试过! onOpen 事件的Request $request 可以通过 获取其他request参数得到nginx转发的IP,onMessage没有API
检查一下nginx配置文件,如果要获取IP需要进行相应的配置。
@cailetech
WebSocketContext:getRequest() 可以拿到open时的request对象
WebSocketContext:getRequest()
https://github.com/swoft-cloud/swoft-component/blob/master/src/websocket-server/src/WebSocketContext.php#L165
php --ri swoole
)php -v
)Details 经过nginx代理转发后,即便配置了remote_ip等参数, $server->getClientInfo($frame->fd)['remote_ip'] 获取到的IP地址依旧是127.0.0.1,所有$server参数都看过了。。。获取不了,麻烦帮忙看看!