typicode / hotel

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

[PROBLEM] Few problems - proxy on chrome, invalid host header with create-react-app #359

Open kazbag opened 4 years ago

kazbag commented 4 years ago

Hi guys, I have few problems with hotel. I use Windows 10 64 bit and Chrome 81.0.4044.129.

First of all I can't find the properly way how to use custom tld on Chrome. One and only thing which is working for me is setting config.json as follows:

{
  "port": 80,
  "host": "127.0.0.1",
  "timeout": 5000,
  "tld": "localhost",
  "proxy": false
}

It only works at port 80 and tld as localhost. I can access my "client" app by typing "http://client.localhost". It works with Chrome, but in i.e. Firefox I have "Cannot reach this site". In Firefox I can type "http://localhost/client" and it's working, but it also redirects me to "http://localhost:60532"

The second issue is in my create-react-app. It's available at i.e. localhost:60532, but when I visit http://client.localhost I'm receiving "Invalid host header" in my browser.

My main package.json looks as follows

 "scripts": {
    "start": "node app.js",
    "install:client": "cd client && npm i",
    "install:server": "cd server && npm i",
    "install:all": "npm run install:server && npm run install:client",
    "dev:server": "npm run dev --prefix server",
    "dev:client": "npm run start --prefix client",
    "dev": "concurrently \"npm run dev:server\" \"npm run dev:client\"",
    "hotel-init:server": "cd server && hotel add \"npm start\" server.js",
    "hotel-init:client": "cd client && hotel add \"npm start\" index.js",
    "hotel-init": "npm run hotel-init:server && npm run hotel-init:client",
    "hotel-start": "hotel start",
    "hotel-stop": "hotel stop",
    "hotel-reset": "hotel stop && hotel start",
    "hotel-info": "hotel --help",
    "postinstall": "npm run install:all && npm run hotel-init"
  },

I don't know is it a bug, maybe it should work as follows? I'm beginner in proxying and hotel so don't blame me please.

@@@ Update

To avoid "Invalid Host header" I had to include --change-origin when do I init my client

    "hotel-init:client": "cd client && hotel add \"npm start\" index.js --change-origin",