Open gdesmott opened 1 month ago
It may relates to the network changes broken the tunnel, there is no logic to handle this scenario.
It may relates to the network changes broken the tunnel, there is no logic to handle this scenario.
I don't think so. The server has a static IP and my app is running on my desktop whose (public) IP is not changing much.
It' quite easy to reproduce, I just have to not use the tunnel for 20 minutes or so.
My app is establishing a tunnel using the
localtunnel_client::open_tunnel()
API
Actually I can reproduce this problem using the localtunnel CLI client as well:
@kaichaosun that does work for you?
Here are nginx
logs when this problem happens. Not sure what it means exactly.
2024/08/05 15:24:31 [error] 935764#935764: *48 connect() failed (111: Connection refused) while connecting to upstream, client: 78.129.103.27, server: *.karapulse.org, request: "GET / HTTP/1.1", upstream: "http://[::1]:3001/", host: "soebly.karapulse.org"
2024/08/05 15:24:31 [debug] 935764#935764: *48 http next upstream, 2
2024/08/05 15:24:31 [debug] 935764#935764: *48 free rr peer 2 4
2024/08/05 15:24:31 [warn] 935764#935764: *48 upstream server temporarily disabled while connecting to upstream, client: 78.129.103.27, server: *.karapulse.org, request: "GET / HTTP/1.1", upstream: "http://[::1]:3001/", host: "soebly.karapulse.org"
So I guess this may actually be a nginx problem?
@kaichaosun do you have a nginx configuration working reliably by any chance? Here is mine.
server {
listen 80;
listen [::]:80;
server_name *.karapulse.org;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name tunnel.karapulse.org;
access_log /var/log/nginx/karapulse-tunnel.access.log;
error_log /var/log/nginx/karapulse-tunnel.error.log debug;
ssl_certificate /etc/letsencrypt/live/karapulse.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/karapulse.org/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://localhost:3000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
server {
listen 443 ssl;
server_name *.karapulse.org;
access_log /var/log/nginx/karapulse-tunnel.access.log;
error_log /var/log/nginx/karapulse-tunnel.error.log debug;
ssl_certificate /etc/letsencrypt/live/karapulse.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/karapulse.org/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://localhost:3001;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
So I guess this may actually be a nginx problem?
Actually maybe not.
I have the same problem when trying to connect directly to the tunnel server by connecting directly to port 3001 and by passing nginx .
@gdesmott I haven't been running it for quite a while, will look into it when I'm free. For now you can probably restart the connection on client side once a while.
localtunnel server
binarylocaltunnel_client::open_tunnel()
APIIt all works perfectly fine, but after a while if the tunnel is not used it stops working.
Here are the logs (using #35) on the server:
Nothing is log in the app so I think the server does not send anything to it.
Also the sockets are not given back to the pool so it will eventually run out of connections.
Any idea what could cause this problem or how to debug it?