Real IP address of websocket clients behind Cloudflare
Options
hainh
✭
Hi,
Our game using websocket (secure if applicable) and we recently run it behind Cloudflare to protect from DDoS. Everything's going great except that the server cannot know real IP address of client connecting to but Cloudflare's proxy server IP. I've searched through the forum and found that proxy is not supported by Photon engine.
Cloudflare's proxy does add an X-Forwarded-For header for the websocket handshake request but how to get this header?
I need this IP for many purposes such as ban players by IP, prevent players with same IP to join to one room.
Our game using websocket (secure if applicable) and we recently run it behind Cloudflare to protect from DDoS. Everything's going great except that the server cannot know real IP address of client connecting to but Cloudflare's proxy server IP. I've searched through the forum and found that proxy is not supported by Photon engine.
Cloudflare's proxy does add an X-Forwarded-For header for the websocket handshake request but how to get this header?
I need this IP for many purposes such as ban players by IP, prevent players with same IP to join to one room.
0
Comments
-
hi, hainh
this feature is not supported.
do you really need to hide your game behind Cloudflare? do you have any real reason for this?
ip address may vary even for differnt connections of same user because usually Dynamic IP address is used. you could use userId to ban player
>prevent players with same IP to join to one room.
this is one is probably most intersting use case, but as i said...
best,
ilya0 -
Hi @chvetsov,
Sorry for the late reply.
My game is a type of gamble, preventing players with same IP to join to one room is for protecting others players from cheating. Banning users by IP I meant banning user from some country that cheat too much or someone use proxy server to hide his IP then register a lot of accounts to get more bonus (we limit number of accounts, 3 as before, created from each IP address).
We've faced some DDoS attack on websocket ports that freeze our server for hours (firewall these ports does help unfreeze the server) and had no choice but using Cloudflare.
I hope Photonengine will update and give some config to get real player's IP address.0 -
well, ok, but we need time to find a good solution
best,
ilya0 -
That's awesome! Thanks.0