It not works when host domain is not top level domain. I want to use subdomain as base domain described in https://github.com/localtunnel/server#use-your-server, such as subdomain.example.com and *.subdomain.example.com. This issue is similar to #21.
It not works when host domain is not top level domain. I want to use subdomain as base domain described in https://github.com/localtunnel/server#use-your-server, such as `subdomain.example.com` and `*.subdomain.example.com`. This issue is similar to #21.
I've been doing a little debugging, and logging hostname and subdomain just above this line yields xxxxxxxxx.localtunnel.example.com and xxxxxxxxx.localtunnel respectively. As a result, I get the error no active client for 'xxxxxxxxx.localtunnel' when I visit http://xxxxxxxxx.localtunnel.example.com in my browser.
@defunctzombie I think var client_id = subdomain; needs to be changed to handle this use case. Perhaps check if subdomain has a dot and, if so, extract the substring up to the first dot?
Are you getting a `no active client` error? I am.
I've been doing a little debugging, and logging `hostname` and `subdomain` just above [this line](https://github.com/localtunnel/server/blob/master/server.js#L49) yields `xxxxxxxxx.localtunnel.example.com` and `xxxxxxxxx.localtunnel` respectively. As a result, I get the error `no active client for 'xxxxxxxxx.localtunnel'` when I visit http://xxxxxxxxx.localtunnel.example.com in my browser.
@defunctzombie I think `var client_id = subdomain;` needs to be changed to handle this use case. Perhaps check if `subdomain` has a dot and, if so, extract the substring up to the first dot?
Furthermore, http://localtunnel.example.com/?new (requested when the client starts up) results in subdomain's value being localtunnel. So it won't get to this line and the new_client function won't be called.
Furthermore, http://localtunnel.example.com/?new (requested when the client starts up) results in `subdomain`'s value being `localtunnel`. So it won't get to [this line](https://github.com/localtunnel/server/blob/master/server.js#L46) and the `new_client` function won't be called.
lt --host http://sub.domain.com:1443 -p 9001
502
Error: localtunnel server returned an error, please try again
at Request._callback (/usr/lib/node_modules/localtunnel/lib/Tunnel.js:54:13)
at Request.self.callback (/usr/lib/node_modules/localtunnel/node_modules/request/main.js:122:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (/usr/lib/node_modules/localtunnel/node_modules/request/main.js:655:16)
at Request.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/usr/lib/node_modules/localtunnel/node_modules/request/main.js:617:14)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:448:13)
lt --host http://domain.com:1443 -p 9001
your url is: http://jddrzcnonz.domain.com:1443
Having the same problem here. When using http://sub.domain.com it returns a 502.
```
lt --host http://sub.domain.com:1443 -p 9001
502
Error: localtunnel server returned an error, please try again
at Request._callback (/usr/lib/node_modules/localtunnel/lib/Tunnel.js:54:13)
at Request.self.callback (/usr/lib/node_modules/localtunnel/node_modules/request/main.js:122:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (/usr/lib/node_modules/localtunnel/node_modules/request/main.js:655:16)
at Request.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/usr/lib/node_modules/localtunnel/node_modules/request/main.js:617:14)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:448:13)
```
But if I use http://domain.com:
```
lt --host http://domain.com:1443 -p 9001
your url is: http://jddrzcnonz.domain.com:1443
```
I think a startup flag should be provided that marks the current server as 'subdomain' server, thus allowing us to change the check performed here , I'll be glad to submit a PR
I think a startup flag should be provided that marks the current server as 'subdomain' server, thus allowing us to change the check performed [here](https://github.com/localtunnel/server/blob/master/server.js#L45) , I'll be glad to submit a PR
@worg sounds good. In fact, I found a workaround with the following modification on the server.js;
(here's the diff)
diff --git a/server.js b/server.js
index 17c2d9f..52db061 100644
--- a/server.js
+++ b/server.js
@@ -41,8 +41,11 @@ function maybe_bounce(req, res, bounce) {
return false;
}
- var subdomain = tldjs.getSubdomain(hostname);
- if (!subdomain) {
+ var subdomain = hostname.split(".")[0];
+ console.log(subdomain)
+
+ //var subdomain = tldjs.getSubdomain(hostname);
+ if (subdomain === 'tunnel') {
return false;
}
But, I believe a startup flag is a better solution.
@worg sounds good. In fact, I found a workaround with the following modification on the `server.js`;
(here's the diff)
```
diff --git a/server.js b/server.js
index 17c2d9f..52db061 100644
--- a/server.js
+++ b/server.js
@@ -41,8 +41,11 @@ function maybe_bounce(req, res, bounce) {
return false;
}
- var subdomain = tldjs.getSubdomain(hostname);
- if (!subdomain) {
+ var subdomain = hostname.split(".")[0];
+ console.log(subdomain)
+
+ //var subdomain = tldjs.getSubdomain(hostname);
+ if (subdomain === 'tunnel') {
return false;
}
```
But, I believe a startup flag is a better solution.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
It not works when host domain is not top level domain. I want to use subdomain as base domain described in https://github.com/localtunnel/server#use-your-server, such as
subdomain.example.comand*.subdomain.example.com. This issue is similar to #21.Are you getting a
no active clienterror? I am.I've been doing a little debugging, and logging
hostnameandsubdomainjust above this line yieldsxxxxxxxxx.localtunnel.example.comandxxxxxxxxx.localtunnelrespectively. As a result, I get the errorno active client for 'xxxxxxxxx.localtunnel'when I visit http://xxxxxxxxx.localtunnel.example.com in my browser.@defunctzombie I think
var client_id = subdomain;needs to be changed to handle this use case. Perhaps check ifsubdomainhas a dot and, if so, extract the substring up to the first dot?Furthermore, http://localtunnel.example.com/?new (requested when the client starts up) results in
subdomain's value beinglocaltunnel. So it won't get to this line and thenew_clientfunction won't be called.Having the same problem here. When using http://sub.domain.com it returns a 502.
But if I use http://domain.com:
I think a startup flag should be provided that marks the current server as 'subdomain' server, thus allowing us to change the check performed here , I'll be glad to submit a PR
@worg sounds good. In fact, I found a workaround with the following modification on the
server.js;(here's the diff)
But, I believe a startup flag is a better solution.
+1
+1
There are a few PRs out to solve this issue; once those merge this will be resolved.