Wrong guest IP for livechat when using proxy


#1

I have RocketChat running behind mod_proxy, and every guest using the livechat client gets the proxy address associated with the guest user in the livechat system.
This causes cross-switching between chats, so suddenly a new user gets his new chat associated with an existing guest user.

Is there a way to set up mod_proxy to get the clients IP through to RocketChat? Using X-Forwarded-For header or something?


#2

Apache has something like mod_rpaf. But I don’t know about nginx. But I can’t quite believe that the livechat session is solely bound to the IP. This would be weird…

Cheers
Thomas


#3

Hm… Seems like we should grab from X-Forwarded-For… Do you happen to be setting that in your proxy settings?


#4

I just set “ProxyPass” and “ProxyPassReverse”… Not sure if I need to to something more…


#5

You’ll want something like this too:

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;

Full example file here: https://rocket.chat/docs/installation/manual-installation/configuring-ssl-reverse-proxy/