NG development server - app connecting to localhost:3000/sockjs-node/info when behind reverse proxy
See original GitHub issueBug 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:
- Created 6 years ago
- Reactions:6
- Comments:11 (1 by maintainers)

Top Related StackOverflow Question
Update I found I could set this setting with the flag
--public-host. which changes sockjs to use the urlhttp://localhost:4200/sockjs-node/info?=XXXXXXXX. I’m also using the flag--disable-host-checkalthough 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-checkit breaks live reloading… People change webpack config to fix this, but we cant change webpack config with angular-cli ? See this.