Add delete tunnel endpoint
#151
+2
-2
@@ -32,8 +32,8 @@ server {
|
|||||||
proxy_busy_buffers_size 256k;
|
proxy_busy_buffers_size 256k;
|
||||||
|
|
||||||
# Ugly fix for Connection timed out error
|
# Ugly fix for Connection timed out error
|
||||||
proxy_send_timeout 150;
|
proxy_send_timeout 300;
|
||||||
proxy_read_timeout 150;
|
proxy_read_timeout 300;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-3
@@ -61,7 +61,8 @@ class Client extends EventEmitter {
|
|||||||
path: req.url,
|
path: req.url,
|
||||||
agent: this.agent,
|
agent: this.agent,
|
||||||
method: req.method,
|
method: req.method,
|
||||||
headers: req.headers
|
headers: req.headers,
|
||||||
|
timeout: 120000 // 2 min, default node timeout
|
||||||
};
|
};
|
||||||
|
|
||||||
const clientReq = http.request(opt, (clientRes) => {
|
const clientReq = http.request(opt, (clientRes) => {
|
||||||
@@ -70,7 +71,9 @@ class Client extends EventEmitter {
|
|||||||
res.writeHead(clientRes.statusCode, clientRes.headers);
|
res.writeHead(clientRes.statusCode, clientRes.headers);
|
||||||
|
|
||||||
// using pump is deliberate - see the pump docs for why
|
// 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
|
// this can happen when underlying agent produces an error
|
||||||
@@ -78,10 +81,14 @@ class Client extends EventEmitter {
|
|||||||
// if we have already sent headers?
|
// if we have already sent headers?
|
||||||
clientReq.once('error', (err) => {
|
clientReq.once('error', (err) => {
|
||||||
// TODO(roman): if headers not sent - respond with gateway unavailable
|
// 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
|
// 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) {
|
handleUpgrade(req, socket) {
|
||||||
|
|||||||
+3
-1
@@ -31,6 +31,8 @@
|
|||||||
"start": "node -r esm bin/server --port 1234 --max-sockets 30",
|
"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",
|
"start-docker": "docker run -d --restart always --name localtunnel --net host defunctzombie/localtunnel-server:latest --port 1234",
|
||||||
"dev": "node-dev bin/server --port 3000",
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user