angelobreuer / localtunnel.net

.NET implementation of a tunnel client for localtunnel.me.
MIT License
124 stars 31 forks source link

Requests not reaching the client #13

Closed zainvegeta closed 2 years ago

zainvegeta commented 2 years ago

Hi there, I hosted the server on aws cloud server with domain name tunnel.mydomain.com also pointed a subdomain one.tunnel.mydomain.com to the same server. Then i connected the client to one.tunnel.mydomain.com providing subdomain as one. The client established connection to server and did display tunnel url as https://one.tunnel.mydomain.com

I tried sending some request to http://one.tunnel.mydomain.com as i had only http. Its reaching the server as i can see it timeout in the logs

web: Request starting HTTP/1.1 GET http://one.tunnel.mydomain.com/ - - Apr 12 17:20:18 ip-172-31-63-123 web: fail: Microsoft.AspNetCore.Server.Kestrel[13] Apr 12 17:20:18 ip-172-31-63-123 web: Connection id "0HMGSJP6SD5OI", Request id "0HMGSJP6SD5OI:00000002": An unhandled exception was thrown by the application. Apr 12 17:20:18 ip-172-31-63-123 web: System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing. Apr 12 17:20:18 ip-172-31-63-123 web: ---> System.TimeoutException: A task was canceled. Apr 12 17:20:18 ip-172-31-63-123 web: ---> System.Threading.Tasks.TaskCanceledException: A task was canceled. Apr 12 17:20:18 ip-172-31-63-123 web: at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken) Apr 12 17:20:18 ip-172-31-63-123 web: at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) Apr 12 17:20:18 ip-172-31-63-123 web: at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)

Is it because i am not having https? Any thing else that i am missing

angelobreuer commented 2 years ago

It seems like the request is getting stuck. One major problem with the original idea of localtunnel is that the server requires to have all available TCP ports over port 1024 open. Probably the client is not reaching your AWS instance, but the connection to the HTTP server is available. If you use Cloudflare as ingress, you have to add a non-HTTP route, to allow traffic to your AWS instance using all TCP ports (possibly available using Cloudflare Spectrum).

If you use the client, you can add the --no-dashboard and --verbose option to print the port the localtunnel server is allocating.

zainvegeta commented 2 years ago

Yes you were correct. I opened all ports and then it started to work. Thankyou very much for developing the server. If you need any help in testing will glad to help. I am using this in one of our projects