Show health details to authorized users
By default the health endpoint shows only the overall status. Two settings reveal more:
show_componentslists each component with its status.show_detailsadds each component’s details, such as the database driver or the free disk space. Whenshow_componentsisnull, it followsshow_details.
Both accept never, always or when_authorized.
Show details to authorized users only
Section titled “Show details to authorized users only”-
Set
show_detailstowhen_authorized. You can use the environment variable:.env ACTUATOR_HEALTH_SHOW_DETAILS=when_authorized -
Define the
viewActuatorgate inAppServiceProvider::boot():app/Providers/AppServiceProvider.php use App\Models\User;use Illuminate\Support\Facades\Gate;Gate::define('viewActuator', fn (User $user) => $user->is_admin); -
Add middleware that authenticates the user, without requiring authentication. Probes still get the minimal response:
config/actuator.php 'health' => ['middleware' => ['web'],'show_details' => env('ACTUATOR_HEALTH_SHOW_DETAILS', 'never'),// ...],With
web, a logged-in administrator who opens/actuator/healthin the browser sees the details. An anonymous request sees only the status. For token clients, use a guard that reads the token, such asauth:sanctum, but note that it then rejects anonymous probes.
Show components but not details
Section titled “Show components but not details”List the components and their statuses for everyone, but keep the details for authorized users:
'show_details' => 'when_authorized','show_components' => 'always',{ "status": "UP", "components": { "ping": { "status": "UP" }, "db": { "status": "UP" } }, "groups": ["liveness", "readiness"]}Show everything outside production
Section titled “Show everything outside production”'show_details' => env('APP_ENV') === 'production' ? 'when_authorized' : 'always',