node-cluster-socket.io
node-cluster-socket.io copied to clipboard
How to use it with nginx reverse proxy?
The connection.remoteAddress is always 127.0.0.1 when using nginx reverse proxy.
I have the same issue here. I read that the only way to fix this is by using a cookie instead of the remoteAddress.
same issue,I have no idea how to solve this problem..
I think we can forward the client ip address from nginx reverse proxy settings
You may want to use the following to get the real IP of the client
const ip = req.headers["x-forwarded-for"] || req.connection.remoteAddress;
as the proxy (HAProxy in my case) sends the IP of the client on the header as "x-forwarded-for"
You may want to use the following to get the real IP of the client
const ip = req.headers["x-forwarded-for"] || req.connection.remoteAddress;as the proxy (HAProxy in my case) sends the IP of the client on the header as "x-forwarded-for"
Where can we access the request object?