Angular 7/8 响应开发服务器上的健康检查
Angular 7/8 respond to health-checks on the dev server
我 运行 angular 开发服务器 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.
它 运行正在 EC2 实例上运行并侦听端口 4200。
我的负载均衡器正在对 / 进行健康检查,但出于某种原因,开发服务器在该路由上未响应 200?
有什么方法可以配置 Angular 开发服务器在某些路由上以 200 响应,它可能是 / 或其他路由?
您正在绑定到 localhost
。任何外部事物都无法到达您的服务器。如果你真的想要,你可以 ng serve --host 0.0.0.0
但这不是一个好主意。开发服务器不是为了安全而构建的。
我 运行 angular 开发服务器 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.
它 运行正在 EC2 实例上运行并侦听端口 4200。 我的负载均衡器正在对 / 进行健康检查,但出于某种原因,开发服务器在该路由上未响应 200?
有什么方法可以配置 Angular 开发服务器在某些路由上以 200 响应,它可能是 / 或其他路由?
您正在绑定到 localhost
。任何外部事物都无法到达您的服务器。如果你真的想要,你可以 ng serve --host 0.0.0.0
但这不是一个好主意。开发服务器不是为了安全而构建的。