I have been using PHP Ratchet with Stunnel for SSL. It's working well. But the problem is, I can't get users real IP address.
I already tried these
$conn->remoteAddress
and with this I am getting 127.0.0.1 (local address)
$conn->WebSocket->request->getHeader('X-Forwarded-For');
and with this I am getting nothing.
Any help!
Or sometimes it's $conn->httpRequest->getHeaders()['X-Forwarded-For'][0]
.
This is really old, but I ran into it just now.
You're looking for $conn->WebSocket->request->getHeader('x-forwarded-for)
or $conn->WebSocket->request->getHeader('x-real-ip')
.
See $conn->WebSocket->request->getHeaders()
for the entire list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With