I was trying to write a request interceptor that would get client's IP via req.connection.remoteAddress and store it for usage from my services.
When I tried to use the req.connection, I found that the req object accessible in the interceptors doesn't have this data. Is there another way to get connection data in interceptors, or is it possible to add this data in the ProxyRequest object?
I searched for it and looks like this object is mounted here. Maybe, the connection data could be sent to interceptors via
const proxyReq = (req as any).proxyReq || {
body: req.body,
headers: Object.assign({}, req.headers),
method: req.method,
url: req.url,
user: req.user,
connection: req.connection // Adding this field connection data from express req would be accessible in middleware req
};
I was trying to write a request interceptor that would get client's IP via
req.connection.remoteAddress
and store it for usage from my services.When I tried to use the
req.connection
, I found that the req object accessible in the interceptors doesn't have this data. Is there another way to get connection data in interceptors, or is it possible to add this data in the ProxyRequest object?I searched for it and looks like this object is mounted here. Maybe, the connection data could be sent to interceptors via
Regards