You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There have been a few issues requesting help with getting the remote IP address of the connected client, but they all assume aedes is not behind a reverse proxy. Specifically, the conn.socket._socket.remoteAddress value on websocket connections for aedes instances behind a reverse proxy always returns the address of the proxy, not the X-Forwarded-For header the proxy adds to all requests.
We're using proxywrap to handle raw TCP requests in proxy-protocol format, but Aedes drops the HTTP request object for websocket requests, so we're not able to access headers and get the X-Forwarded-For value.
I submitted pull request #322 to add the original HTTP request to the Aedes Client object.
No tests, but there's almost no new functionality 🤷♂.
The resulting code looks something like this:
const broker = new Aedes(opts);
broker.on('client', (client) => {
if (client.req) {
console.log(client.req.headers['x-forwarded-for'])
}
})
Is there a better way to get this functionality without changing aedes?
There have been a few issues requesting help with getting the remote IP address of the connected client, but they all assume aedes is not behind a reverse proxy. Specifically, the
conn.socket._socket.remoteAddress
value on websocket connections for aedes instances behind a reverse proxy always returns the address of the proxy, not the X-Forwarded-For header the proxy adds to all requests.We're using proxywrap to handle raw TCP requests in proxy-protocol format, but Aedes drops the HTTP request object for websocket requests, so we're not able to access headers and get the
X-Forwarded-For
value.I submitted pull request #322 to add the original HTTP request to the Aedes
Client
object.No tests, but there's almost no new functionality 🤷♂.
The resulting code looks something like this:
Is there a better way to get this functionality without changing aedes?
related to #222
The text was updated successfully, but these errors were encountered: