[Libwebsockets] Client/Server Version Compatibility and Getting Client IP Behind Reverse Proxy

Andy Green andy at warmcat.com
Mon Apr 29 21:58:47 CEST 2019



On 29/04/2019 14:20, Luke Weaver wrote:
> Hello,
> 
> I have a server and clients with version 2.4.0 communicating with each 
> other. I upgraded the server to 3.1; do I need to upgrade the clients as 

Generally, no... if the reverse proxying works well then the clients 
have no idea it's there.

> well? The purpose of the upgrade is to receive the clients IP behind a 
> reverse proxy. I have tried forwarding and reading the IP with 
> get_peer_addresses but returns local host. I am guessing that it is a 

That is correct... the reverse proxy works by opening a new client 
connection for each inbound connection, so the thing that talks to lws 
is indeed coming from 127.0.0.1.

> header problem that has been resolved since.

I'm not 100% sure what you mean there, but the convention for these 
reverse proxies is to add a header X-Forwarded-For 
(WSI_TOKEN_X_FORWARDED_FOR) for the server, containing the original 
client IP.

-Andy

> Sincerely,
> Luke Weaver
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 


More information about the Libwebsockets mailing list