Fix handling of REMOTE_PORT
This commit is contained in:
parent
4829078b00
commit
e2e374a0e0
2 changed files with 6 additions and 2 deletions
6
index.js
6
index.js
|
@ -202,7 +202,11 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
|
||||||
nEnv["SCGI"] = "1";
|
nEnv["SCGI"] = "1";
|
||||||
nEnv["REQUEST_URI"] = (!origHref || origHref == href) ? req.url : (origHref + (uobject.search ? ("?" + uobject.search) : ""));
|
nEnv["REQUEST_URI"] = (!origHref || origHref == href) ? req.url : (origHref + (uobject.search ? ("?" + uobject.search) : ""));
|
||||||
nEnv["REMOTE_ADDR"] = (req.socket.realRemoteAddress ? req.socket.realRemoteAddress : ((req.headers["x-forwarded-for"] && configJSON.enableIPSpoofing) ? req.headers["x-forwarded-for"].split(",")[0].replace(/ /g, "") : req.socket.remoteAddress)).replace(/^::ffff:/i, "");
|
nEnv["REMOTE_ADDR"] = (req.socket.realRemoteAddress ? req.socket.realRemoteAddress : ((req.headers["x-forwarded-for"] && configJSON.enableIPSpoofing) ? req.headers["x-forwarded-for"].split(",")[0].replace(/ /g, "") : req.socket.remoteAddress)).replace(/^::ffff:/i, "");
|
||||||
nEnv["REMOTE_PORT"] = (req.socket.realRemotePort ? req.socket.realRemotePort : req.socket.remotePort);
|
if(req.socket.realRemoteAddress && req.socket.realRemotePort) {
|
||||||
|
nEnv["REMOTE_PORT"] = req.socket.realRemotePort;
|
||||||
|
} else if(!(req.socket.realRemoteAddress && !req.socket.realRemotePort)) {
|
||||||
|
nEnv["REMOTE_PORT"] = req.socket.remotePort;
|
||||||
|
}
|
||||||
if (req.socket.encrypted) nEnv["HTTPS"] = "ON";
|
if (req.socket.encrypted) nEnv["HTTPS"] = "ON";
|
||||||
if (req.headers["content-type"]) nEnv["CONTENT_TYPE"] = req.headers["content-type"];
|
if (req.headers["content-type"]) nEnv["CONTENT_TYPE"] = req.headers["content-type"];
|
||||||
nEnv["CONTENT_LENGTH"] = "0";
|
nEnv["CONTENT_LENGTH"] = "0";
|
||||||
|
|
2
mod.info
2
mod.info
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"name": "DorianTech OrangeCircle SCGI client for SVR.JS",
|
"name": "DorianTech OrangeCircle SCGI client for SVR.JS",
|
||||||
"version": "1.0.5"
|
"version": "1.0.6"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue