Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kazbag opened this issue May 4, 2020 · 0 comments

Comments

@kazbag
Copy link

kazbag commented May 4, 2020

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",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant