typicode / hotel

🏩 A simple process manager for developers. Start apps from your browser and access them using local domains
MIT License
9.98k stars 422 forks source link

Using subdomains and "Can't find server id: undefined" error #320

Open twigs67 opened 6 years ago

twigs67 commented 6 years ago

I'm attempting to use https via local signed cert, but I'm not figuring it out.

//.hotel/conf.json
{
  "port": 2000,
  "host": "127.0.0.1",
  "tld": "test", 
  "proxy": false
}

//servers/adonis-blog.json
{
  "cwd": "/Users/websites/adonis-blog",
  "cmd": "npm start",
  "env": {
    "PATH": "XXX",
    "PORT": 4000
  }
}

When I try to go to https://app.localhost.test I get the error "Can't find server id: undefined"

I was hoping someone might know how to handle this?

j-f1 commented 6 years ago

Does app.hotel.test work?

twigs67 commented 6 years ago

@j-f1 No, app.hotel.test brings me to the main hotel interface strangely enough. The only url that works is https://app.localhost:4000/.

Unfortunately, I can't get https to work with this url as it doesn't show a tld.

typicode commented 6 years ago

@twigs67 what if you try https://adonis-blog.test or https://subdomain.adonis-blog.test?

twigs67 commented 6 years ago

@typicode I get the error page:

Error
Can't connect to server on PORT=4000

http://localhost:4000

Possible causes
Server crashed or timeout of 5000ms exceeded.
Server is not listening on PORT environment variable.
Try to reload or check logs.

Logs

> adonis-blog-demo@4.0.0 start /Users/AF/websites/adonis-blog
> node server.js

2018-10-03T22:23:24.522Z - info: serving app on http://127.0.0.1:4000

It may be worth noting that my hosts file reads:

127.0.0.1       localhost.test
127.0.0.1       app.localhost
twigs67 commented 6 years ago

@j-f1 @typicode

I got it working @ http://adonis-blog.test but it won't work when a subdomain is added or under https.

For the subdomain, it seems that it doesn't register anything before adonis-blog as http://app.adonis-blog.test works, but when I add the subdomain in the server, http://app.adonis-blog.test produces HttpException: Route not found GET /

Also, I'm using my own self-signed cert, but I noticed that .hotel has it's own cert in it. Should I be using this instead?

udayrajMT commented 5 years ago

For me the issue was with wrong server name. For accepting subdomains, I think you should keep the name as a regex to accept it.

hotel add --name "*.adonis-blog"  <other args>