This came from one of my needs developing a websocket server using this library's implementation.
I proxy the Deno application behind Nginx, which causes the IP sent by this library to be the IP of the Nginx proxy.
This change allows you to specify the header which you want to forward the real ip to the ip of the socket.
It's usage is as simple as this.
const WSS = new WebSocketServer(5050, 'x-forwarded-for');
This will run a server on port 5050 where nginx sets the real IP to header 'x-forwarded-for'. This then replaces the IP of the proxy so when attempting to view the connection info of a socket, you will get the real IP instead of the nginx proxy IP.
This came from one of my needs developing a websocket server using this library's implementation. I proxy the Deno application behind Nginx, which causes the IP sent by this library to be the IP of the Nginx proxy.
This change allows you to specify the header which you want to forward the real ip to the ip of the socket.
It's usage is as simple as this.
const WSS = new WebSocketServer(5050, 'x-forwarded-for');
This will run a server on port 5050 where nginx sets the real IP to header 'x-forwarded-for'. This then replaces the IP of the proxy so when attempting to view the connection info of a socket, you will get the real IP instead of the nginx proxy IP.