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

Webpack dev server with Vagrant forwarded port #3361

Closed
elclanrs opened this issue Dec 3, 2016 · 1 comment
Closed

Webpack dev server with Vagrant forwarded port #3361

elclanrs opened this issue Dec 3, 2016 · 1 comment

Comments

@elclanrs
Copy link

elclanrs commented Dec 3, 2016

macOS El Capitan
angular-cli: 1.0.0-beta.21
node: 6.9.1
os: darwin x64

I'm running ng serve within a Vagrant box. I configured Nginx following these instructions. Everything works as expected when I forward port 4200 in Vagrant, but it fails with any other port, with this error:

[WDS] Disconnected!
GET http://localhost:4200/sockjs-node/info?t=1480728685812 net::ERR_CONNECTION_REFUSED

I understand why this happens, it's because in the guest I reverse proxy port 4200 to port 80 which is exposed as port 1234 in the host, like:

config.vm.network 'forwarded_port', guest: 80, host: 1234

In order to get it working I need the following:

GET http://localhost:1234/sockjs-node/info?t=1480728685812

I found out the code that handles this in server-webpack.ts, line 38:

`webpack-dev-server/client?http://${serveTaskOptions.host}:${serveTaskOptions.port}/`

I need to hardcode serveTaskOptions.port to 1234 make it work.

I think Webpack's --public option may help, but it is not exposed to ng serve. Any ideas how to get this working without the hack? Perhaps exposing a different port option for port forwarding, since the guest port where webpack is running may not be the same port in the host?

@elclanrs elclanrs changed the title Expose webpack's --public option to ng serve Webpack dev server error with Vagrant forwarded port Dec 3, 2016
@elclanrs elclanrs changed the title Webpack dev server error with Vagrant forwarded port Webpack dev server with Vagrant forwarded port Dec 3, 2016
asnowwolf pushed a commit to asnowwolf/angular-cli that referenced this issue Apr 12, 2017
)

This provides implementations for the following serve command options:

live-reload [boolean; default: true] -- flag to control the browser live reload capability
live-reload-client [URL; default: ssl/host/port command options] -- specify the URL that the live reload browser client will use

Closes angular#3361
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants