mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] Use req.connection for all x-forward-* headers
This commit is contained in:
parent
216d46dc81
commit
f6dc12a971
@ -433,10 +433,10 @@ HttpProxy.prototype.proxyRequest = function (req, res, options) {
|
||||
// * `x-forwarded-proto`: Protocol of the original request
|
||||
// * `x-forwarded-port`: Port of the original request.
|
||||
//
|
||||
if (options.enableXForwarded === true && req.connection) {
|
||||
if (options.enableXForwarded === true && req.connection && req.connection.socket) {
|
||||
req.headers['x-forwarded-for'] = req.connection.remoteAddress || req.connection.socket.remoteAddress;
|
||||
req.headers['x-forwarded-port'] = req.connection.remotePort || req.connection.socket.remotePort;
|
||||
req.headers['x-forwarded-proto'] = res.connection.pair ? 'https' : 'http';
|
||||
req.headers['x-forwarded-proto'] = req.connection.pair ? 'https' : 'http';
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user