404 when accessing subdomain created by local tunnel client #198

Open
opened 2023-07-05 09:00:23 +00:00 by anthonyeric-son · 2 comments
anthonyeric-son commented 2023-07-05 09:00:23 +00:00 (Migrated from github.com)

SETUP

I have my own copy of the tunnel server running on a cloud server (vultr.com).
I already have a wildcard domain assigned to the cloud server (e.g. *.mydomain.com).

The Localtunnel server is running with the following parameters:

node -r esm bin/server.js --port 1234 --domain test.mydomain.com
localtunnel server listening on port: 1234 +0ms

I am able to confirm the server is accessible via the domain name:

curl http://test.mydomain.com:1234
Redirecting to https://localtunnel.github.io/www/.
curl http://test.mydomain.com:1234/api/status
{"tunnels":0,"mem":{"rss":50446336,"heapTotal":13225984,"heapUsed":10797176,"external":3097584,"arrayBuffers":982138}}

NOTE: The "mydomain" is not the real domain. Not sure if I'm at liberty to give out the real domain name. But for the sake of describing my problem, I think it should suffice.

On my local machine, I run the localtunnel client with the following parameters:

node bin/lt.js -p 8181 -h http://test.mydomain.com:1234 -s device
your url is: http://device.test.mydomain.com:1234

On the server side, the console log is updated:

node -r esm bin/server.js --port 1234 --domain test.mydomain.com
localtunnel server listening on port: 1234 +0ms
localtunnel:server making new client with id device +0ms

Also, on my local machine, I have a simple http server running on port 8181

PROBLEM

When I try to access the simple http server using the url, generated by the localtunnel client, i.e.:

curl http://device.test.mydomain.com:1234

I get a 404 response.

QUESTION

Are there any other settings I need to do on the cloud server to get this working?
Perhaps there are some parameters I missed?

I tested using your default server:

node bin/lt.js -p 8181 -s device
your url is: https://device.loca.lt

And this one works without any probelms.

Thanks.

### SETUP I have my own copy of the tunnel server running on a cloud server (vultr.com). I already have a wildcard domain assigned to the cloud server (e.g. *.mydomain.com). The Localtunnel server is running with the following parameters: > node -r esm bin/server.js --port 1234 --domain test.mydomain.com > localtunnel server listening on port: 1234 +0ms I am able to confirm the server is accessible via the domain name: > curl http://test.mydomain.com:1234 > Redirecting to <a href="https://localtunnel.github.io/www/">https://localtunnel.github.io/www/</a>. > curl http://test.mydomain.com:1234/api/status > {"tunnels":0,"mem":{"rss":50446336,"heapTotal":13225984,"heapUsed":10797176,"external":3097584,"arrayBuffers":982138}} NOTE: The "mydomain" is not the real domain. Not sure if I'm at liberty to give out the real domain name. But for the sake of describing my problem, I think it should suffice. On my local machine, I run the localtunnel client with the following parameters: > node bin/lt.js -p 8181 -h http://test.mydomain.com:1234 -s device > your url is: http://device.test.mydomain.com:1234 On the server side, the console log is updated: > node -r esm bin/server.js --port 1234 --domain test.mydomain.com > localtunnel server listening on port: 1234 +0ms > localtunnel:server making new client with id device +0ms Also, on my local machine, I have a simple http server running on port 8181 ### PROBLEM When I try to access the simple http server using the url, generated by the localtunnel client, i.e.: > curl http://device.test.mydomain.com:1234 I get a **404** response. ### QUESTION Are there any other settings I need to do on the cloud server to get this working? Perhaps there are some parameters I missed? I tested using your default server: > node bin/lt.js -p 8181 -s device > your url is: https://device.loca.lt And this one works without any probelms. Thanks.
anthonyeric-son commented 2023-07-05 09:51:51 +00:00 (Migrated from github.com)

WAIT! I think I found the culprit.

When I ran the Localtunnel server with DEBUG=* option, I saw that it was also creating a new listening server with a dynamic TCP port after my local tunnel connects:

localtunnel:server making new client with id device +0ms
lt:TunnelAgent[device] tcp server listening on port: 42071 +0ms <-------
lt:ClientManager removing client: device +0ms
lt:TunnelAgent[device] closed tcp socket +1s
lt:TunnelAgent[device] closed tcp socket +0ms

But on the cloud server, I only opened the port 1234 in ufw.

When I disabled ufw, everything started working!
I'll continue playing around

WAIT! I think I found the culprit. When I ran the Localtunnel server with `DEBUG=*` option, I saw that it was also creating a new listening server with a dynamic TCP port after my local tunnel connects: > localtunnel:server making new client with id device +0ms > lt:TunnelAgent[device] tcp server listening on port: 42071 +0ms <------- > lt:ClientManager removing client: device +0ms > lt:TunnelAgent[device] closed tcp socket +1s > lt:TunnelAgent[device] closed tcp socket +0ms But on the cloud server, I only opened the port 1234 in ufw. When I disabled ufw, everything started working! I'll continue playing around
yashwanth2714 commented 2023-12-30 10:37:54 +00:00 (Migrated from github.com)

@anthonyeric-son I'm experiencing a similar issue with AWS. I use EC2 for the server and Route 53 for DNS records, which are directed to the ALB with ACM for HTTPS. Sub-domains function properly when using the EC2 instance's IP address, but encounter issues when utilizing the ALB for HTTPS support. Security Group rules permit traffic from all sources. I would appreciate any assistance. I have been unable to resolve this for 10 days.

@anthonyeric-son I'm experiencing a similar issue with AWS. I use EC2 for the server and Route 53 for DNS records, which are directed to the ALB with ACM for HTTPS. Sub-domains function properly when using the EC2 instance's IP address, but encounter issues when utilizing the ALB for HTTPS support. Security Group rules permit traffic from all sources. I would appreciate any assistance. I have been unable to resolve this for 10 days.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hoelee/server#198
No description provided.