Make reverse proxy mod establish only close connections, no keep-alive
This commit is contained in:
parent
bb938f3cb0
commit
908ad23ef5
2 changed files with 7 additions and 2 deletions
7
index.js
7
index.js
|
@ -51,20 +51,25 @@ Mod.prototype.callback = function callback(req, res, serverconsole, responseEnd,
|
||||||
delete hdrs[":scheme"];
|
delete hdrs[":scheme"];
|
||||||
delete hdrs[":authority"];
|
delete hdrs[":authority"];
|
||||||
delete hdrs[":path"];
|
delete hdrs[":path"];
|
||||||
|
delete hdrs["keep-alive"];
|
||||||
|
hdrs["connection"] = "close";
|
||||||
var options = {
|
var options = {
|
||||||
hostname: (secureHostname && req.socket.encrypted) ? secureHostname : hostname,
|
hostname: (secureHostname && req.socket.encrypted) ? secureHostname : hostname,
|
||||||
port: (secureHostname && req.socket.encrypted) ? securePort : port,
|
port: (secureHostname && req.socket.encrypted) ? securePort : port,
|
||||||
path: req.url,
|
path: req.url,
|
||||||
method: req.method,
|
method: req.method,
|
||||||
headers: hdrs,
|
headers: hdrs,
|
||||||
|
joinDuplicateHeaders: true,
|
||||||
rejectUnauthorized: false
|
rejectUnauthorized: false
|
||||||
};
|
};
|
||||||
var proxy = ((secureHostname && req.socket.encrypted) ? https : http).request(options, function(sres) {
|
var proxy = ((secureHostname && req.socket.encrypted) ? https : http).request(options, function(sres) {
|
||||||
serverconsole.resmessage("Connected to back-end!");
|
serverconsole.resmessage("Connected to back-end!");
|
||||||
delete sres.headers["connection"];
|
delete sres.headers["connection"];
|
||||||
delete sres.headers["Connection"];
|
delete sres.headers["Connection"];
|
||||||
delete sres.headers["Transfer-Encoding"];
|
|
||||||
delete sres.headers["transfer-encoding"];
|
delete sres.headers["transfer-encoding"];
|
||||||
|
delete sres.headers["Transfer-Encoding"];
|
||||||
|
delete sres.headers["keep-alive"];
|
||||||
|
delete sres.headers["Keep-Alive"];
|
||||||
res.writeHead(sres.statusCode, sres.headers);
|
res.writeHead(sres.statusCode, sres.headers);
|
||||||
sres.pipe(res, {
|
sres.pipe(res, {
|
||||||
end: true
|
end: true
|
||||||
|
|
2
mod.info
Executable file → Normal file
2
mod.info
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"name": "Reverse proxy mod for SVR.JS 3.x",
|
"name": "Reverse proxy mod for SVR.JS 3.x",
|
||||||
"version": "1.0.2"
|
"version": "1.0.3"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue