question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NG development server - app connecting to localhost:3000/sockjs-node/info when behind reverse proxy

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [X ] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.1.0-rc.0 node: 7.7.3 os: linux x64 @angular/cli: 1.1.0-rc.0 @angular/animations: 4.1.3 @angular/common: 4.1.3 @angular/compiler: 4.1.3 @angular/core: 4.1.3 @angular/forms: 4.1.3 @angular/http: 4.1.3 @angular/platform-browser: 4.1.3 @angular/platform-browser-dynamic: 4.1.3 @angular/router: 4.1.3 @angular/compiler-cli: 4.1.3 Linux (Ubuntu)

Details

Hi. I’m using the NG development server behind an apache reverse proxy to avoid security domain/cors issues between our front and backend. With rc0 and ‘–disable-host-check’ this all seems to work perfectly. Expect that I see following errors reported in the browser: GET http://localhost:3000/sockjs-node/info?t=1495632403818 net::ERR_CONNECTION_REFUSED

The URL int he browser is not localhost, but that of the reverse proxy:" thttp://proxhost/…" . Might the localhost be due to some absolute path present somewhere in the NG development server? Afaic it does not seem to break anything. I start the server like this: ng serve --host 0.0.0.0 --port 3000 --disable-host-check

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
JoshDSommercommented, Nov 3, 2017

Update I found I could set this setting with the flag --public-host. which changes sockjs to use the url http://localhost:4200/sockjs-node/info?=XXXXXXXX. I’m also using the flag --disable-host-check although I think I may not actually need it in the future. for anyone else have the same problem this is what my start script looks like now.

ng server --aot --public-host=\"http://localhost:4200\" --disable-host-check

2reactions
bravikcommented, May 30, 2017

it breaks live reloading… People change webpack config to fix this, but we cant change webpack config with angular-cli ? See this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I use "ng serve" with multiple apps hosted through an ...
Use for a complex dev server setup, such as one with reverse proxies." Share.
Read more >
NGINX as Reverse Proxy for Node or Angular application
In this tutorial, we will explore how NGINX can be used as a reverse proxy server for a Node or an Angular application....
Read more >
Mastering Angular proxy configuration | by JM Robles - Medium
Rarely you have to develop an isolate Angular app. ... Angular CLI provides a solution to bypass these problems: reverse proxy server.
Read more >
The best ways to connect to the server using Angular CLI
ng build, ng serve, ng test. But there is one (and a very important one) task that needs to be configured once the...
Read more >
Live Reloading An Angular 2+ App Behind NGINX
This command builds the app, serves it (using webpack-dev-server), and then watches for ... Reverse proxy traffic to this port using NGINX.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found