SFS2X behind Amazon ELB and client IP

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

blackbird700
Posts: 8
Joined: 19 Dec 2018, 10:00

SFS2X behind Amazon ELB and client IP

Postby blackbird700 » 19 Dec 2018, 10:24

Which headers does SFS2X read for geolocation info?
We're testing server behind Amazon ELB proxy, and in admin tool I see IP address of proxy when user connects.

ELB is adding automatically X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Port headers (I guess SFS is reading headers before connection is Upgraded to websocket)

I've found simillar topics but didn't find what I need
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X behind Amazon ELB and client IP

Postby Lapo » 19 Dec 2018, 10:43

Hi,
the server uses the IP address of the connecting client, directly from it's socket. If a proxy is in between all connections will appear as coming from that source.

ELB is adding automatically X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Port headers (I guess SFS is reading headers before connection is Upgraded to websocket)

These are HTTP related headers, which are irrelevant for SmartFoxServer unless you're connecting via websockets.

At the moment we don't support these headers for websocket connections but we might look into it for a future release.
As I mentioned, keep in mind that this won't work for standard TCP sockets and UDP.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
blackbird700
Posts: 8
Joined: 19 Dec 2018, 10:00

Re: SFS2X behind Amazon ELB and client IP

Postby blackbird700 » 19 Dec 2018, 13:03

So basically, it doesn't support proxied requests?
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X behind Amazon ELB and client IP

Postby Lapo » 19 Dec 2018, 14:41

Requests work, of course. What does not work is recognizing the original sender IP because the proxy is the one establishing the physical connection to the server.

With websockets it should be possible to detect those HTTP headers and make sure the server obtains the correct client IP.

Are you using TCP sockets? Or websocket?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
blackbird700
Posts: 8
Joined: 19 Dec 2018, 10:00

Re: SFS2X behind Amazon ELB and client IP

Postby blackbird700 » 20 Dec 2018, 10:33

Lapo wrote:Requests work, of course. What does not work is recognizing the original sender IP because the proxy is the one establishing the physical connection to the server.


Yes, I didn't express my self correctly, but i thought that.

Lapo wrote:With websockets it should be possible to detect those HTTP headers and make sure the server obtains the correct client IP.

Are you using TCP sockets? Or websocket?

Thanks


We're using websocket (with binary protocol) - HTML5 + JS
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X behind Amazon ELB and client IP

Postby Lapo » 20 Dec 2018, 11:14

Okay. I've added a note to look into this for the next SFS2X update.

Happy holidays.
Lapo

--

gotoAndPlay()

...addicted to flash games
blackbird700
Posts: 8
Joined: 19 Dec 2018, 10:00

Re: SFS2X behind Amazon ELB and client IP

Postby blackbird700 » 20 Dec 2018, 11:32

thanks!

Happy holidays to you too

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 100 guests