0

I run the angular dev server with ng serve:

$ ng serve
10% building 3/3 modules 0 activeℹ 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: 404s will fallback to //index.html

chunk {main} main.js, main.js.map (main) 49.4 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 264 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 10.1 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 4.08 MB [initial] [rendered]
Date: 2019-08-27T19:37:48.511Z - Hash: df1053ce80b7b0af763f - Time: 8515ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
ℹ 「wdm」: Compiled successfully.

it's running on an EC2 instance and listening on port 4200. My load balancer is doing health checks on /, but for some reason the dev server is not responding with a 200 on that route?

Is there some way to configure the Angular dev server to respond with a 200 on some route, it could be / or some other route?

  • Where have you set your health check at load balancer level? Load Balancer can even check if the service is up and running and give 200. So what is the health check configuration that you have set up? – Pacifist Aug 27 '19 at 19:45
  • refer AWS Documentation: https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-healthchecks.html – Pacifist Aug 27 '19 at 19:45
  • my health check is current just `GET /` on port 4200 –  Aug 27 '19 at 21:09

1 Answers1

0

You are binding to localhost. Nothing external can reach your server. If you really want you can ng serve --host 0.0.0.0 but this is not a good idea. The dev server is not built to be secure.

Pace
  • 41,875
  • 13
  • 113
  • 156
  • i didn't know localhost and 0.0.0.0 were different, does 0.0.0.0 have a name? Well I guess localhost is 127.0.0.1 –  Aug 28 '19 at 04:24
  • https://stackoverflow.com/questions/20778771/what-is-the-difference-between-0-0-0-0-127-0-0-1-and-localhost If you bind to localhost or 127.0.0.1 then you process will only accept TCP connections originating from the local host. This is often a default for security purposes. – Pace Aug 28 '19 at 06:33