update stuff

This commit is contained in:
Yaroslav Kukharuk
2020-11-02 15:49:50 +02:00
parent d4a77b07d9
commit 7238d509f1
3 changed files with 15 additions and 6 deletions
+2 -2
View File
@@ -32,8 +32,8 @@ server {
proxy_busy_buffers_size 256k;
# Ugly fix for Connection timed out error
proxy_send_timeout 150;
proxy_read_timeout 150;
proxy_send_timeout 300;
proxy_read_timeout 300;
}
}
+10 -3
View File
@@ -61,7 +61,8 @@ class Client extends EventEmitter {
path: req.url,
agent: this.agent,
method: req.method,
headers: req.headers
headers: req.headers,
timeout: 120000 // 2 min, default node timeout
};
const clientReq = http.request(opt, (clientRes) => {
@@ -70,7 +71,9 @@ class Client extends EventEmitter {
res.writeHead(clientRes.statusCode, clientRes.headers);
// using pump is deliberate - see the pump docs for why
pump(clientRes, res);
pump(clientRes, res, function(err) {
this.debug('> PIPE FINISHED, %s', err);
});
});
// this can happen when underlying agent produces an error
@@ -78,10 +81,14 @@ class Client extends EventEmitter {
// if we have already sent headers?
clientReq.once('error', (err) => {
// TODO(roman): if headers not sent - respond with gateway unavailable
this.debug('ERROR < %s', req.url);
this.debug(err);
});
// using pump is deliberate - see the pump docs for why
pump(req, clientReq);
pump(req, clientReq, function(err) {
this.debug('< PIPE FINISHED, %s', err);
});
}
handleUpgrade(req, socket) {
+3 -1
View File
@@ -31,6 +31,8 @@
"start": "node -r esm bin/server --port 1234 --max-sockets 30",
"start-docker": "docker run -d --restart always --name localtunnel --net host defunctzombie/localtunnel-server:latest --port 1234",
"dev": "node-dev bin/server --port 3000",
"stuff": "docker build --tag a8c-lt:1.0 . && docker run -d --restart always --name lt --net host a8c-lt:1.0 --port 1234"
"stuff": "docker build --tag a8c-lt:1.0 . && docker container rm -f $(docker ps -aqf 'name=lt') && docker run -d --restart always --name lt --net host a8c-lt:1.0 --port 1234",
"nginxlog": "sudo tail -f /var/log/nginx/error.log",
"log": "docker logs lt -f --tail 2000"
}
}