Skip to content

Expose endpoints

Only health is exposed by default. An endpoint that is not exposed has no route, so it returns HTTP 404. The discovery endpoint at /actuator is always registered and lists only the exposed endpoints.

Publish the configuration file first if you have not done so:

Terminal window
php artisan vendor:publish --tag=actuator-config

List the endpoint IDs in exposure.include:

config/actuator.php
'exposure' => [
'include' => ['health', 'info'],
'exclude' => [],
],

The built-in IDs are health, info, env, mappings, scheduledtasks and prometheus. A custom endpoint is exposed the same way, with the ID it was registered under. The * wildcard includes custom endpoints.

Exposing prometheus gives the metrics an address. It does not start or stop their recording, see collect metrics with Prometheus.

Use the * wildcard:

config/actuator.php
'exposure' => [
'include' => ['*'],
'exclude' => [],
],

List the endpoints to keep closed in exposure.exclude. An excluded endpoint is never exposed, even when include names it or uses *:

config/actuator.php
'exposure' => [
'include' => ['*'],
'exclude' => ['env'],
],

Expose different endpoints per environment

Section titled “Expose different endpoints per environment”

The configuration file is plain PHP, so you can read the environment. For example, expose everything locally and only health and info elsewhere:

config/actuator.php
'exposure' => [
'include' => env('APP_ENV') === 'local' ? ['*'] : ['health', 'info'],
'exclude' => [],
],

Ask the discovery endpoint which endpoints are exposed:

Terminal window
curl http://localhost/actuator

If you cache routes, an exposure change takes effect only after you rebuild the cache:

Terminal window
php artisan route:clear
php artisan route:cache