mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] Set x-forwarded-for from req.connection.socket.remoteAddress if req.connection.remoteAddress is not defined
This commit is contained in:
parent
f1c0f641aa
commit
e9b3ec9b1d
@ -346,7 +346,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
|
|||||||
//
|
//
|
||||||
// Add `x-forwarded-for` header to availible client IP to apps behind proxy
|
// Add `x-forwarded-for` header to availible client IP to apps behind proxy
|
||||||
//
|
//
|
||||||
req.headers['x-forwarded-for'] = req.connection.remoteAddress;
|
req.headers['x-forwarded-for'] = req.connection.remoteAddress || req.connection.socket.remoteAddress;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Emit the `start` event indicating that we have begun the proxy operation.
|
// Emit the `start` event indicating that we have begun the proxy operation.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user