typicode / hotel

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

Passing hostname to webpack-dev-server #238

Closed mimischi closed 6 years ago

mimischi commented 6 years ago

I've just setup a webpack-dev-server project via

npm install -g vue-cli
vue init webpack hackernews-vue-apollo

The config specifies that one can set process.env.HOST to override the default host: localhost. Is there currently any way to pass that variable from the hotel CLI? I was not able to get it working this way.

j-f1 commented 6 years ago

If you pass --change-origin to the hotel add command, the .dev proxy will rewrite the Host header of the request to match the host and port that the server is listening on.

mimischi commented 6 years ago

Thanks! This works :)

For reference, using this hotel add command resolves the issue:

hotel add 'yarn run dev --port $PORT' --name hn --change-origin

The app is then available via http://hn.dev.