node-cluster-socket.io icon indicating copy to clipboard operation
node-cluster-socket.io copied to clipboard

How to use it with nginx reverse proxy?

Open rohitkhatri opened this issue 7 years ago • 5 comments

The connection.remoteAddress is always 127.0.0.1 when using nginx reverse proxy.

rohitkhatri avatar Feb 23 '18 07:02 rohitkhatri

I have the same issue here. I read that the only way to fix this is by using a cookie instead of the remoteAddress.

cgzegarra avatar Jun 05 '18 06:06 cgzegarra

same issue,I have no idea how to solve this problem..

hequanb avatar Jan 24 '19 03:01 hequanb

I think we can forward the client ip address from nginx reverse proxy settings

casperon avatar Mar 11 '19 16:03 casperon

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"

jmlxxvi avatar Sep 24 '19 15:09 jmlxxvi

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?

Boohi avatar Nov 25 '19 15:11 Boohi