@@ -130,19 +130,20 @@ public static TBuilder AddDefaultHealthChecks<TBuilder>(this TBuilder builder) w
130130
131131 public static WebApplication MapDefaultEndpoints ( this WebApplication app )
132132 {
133- // Adding health checks endpoints to applications in non-development environments has security implications.
134- // See https://aka.ms/dotnet/aspire/healthchecks for details before enabling these endpoints in non-development environments.
135- if ( app . Environment . IsDevelopment ( ) )
136- {
137- // All health checks must pass for app to be considered ready to accept traffic after starting
138- _ = app . MapHealthChecks ( HealthEndpointPath ) ;
133+ // Health check endpoints are essential for production (load balancers, orchestrators, monitoring).
134+ // These endpoints return minimal information (200 OK or 503 Service Unavailable).
135+ // For production deployments, use network-level protection (firewall rules) to restrict access
136+ // to trusted sources: load balancers, Kubernetes, monitoring systems, internal networks.
137+ // See https://aka.ms/dotnet/aspire/healthchecks for more details.
139138
140- // Only health checks tagged with the "live" tag must pass for app to be considered alive
141- _ = app . MapHealthChecks ( AlivenessEndpointPath , new HealthCheckOptions
142- {
143- Predicate = r => r . Tags . Contains ( "live" )
144- } ) ;
145- }
139+ // Readiness probe: All health checks must pass for app to be ready to accept traffic
140+ _ = app . MapHealthChecks ( HealthEndpointPath ) ;
141+
142+ // Liveness probe: Only "live" tagged checks must pass for app to be considered alive
143+ _ = app . MapHealthChecks ( AlivenessEndpointPath , new HealthCheckOptions
144+ {
145+ Predicate = r => r . Tags . Contains ( "live" )
146+ } ) ;
146147
147148 return app ;
148149 }
0 commit comments