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:
php artisan vendor:publish --tag=actuator-configExpose specific endpoints
Section titled “Expose specific endpoints”List the endpoint IDs in exposure.include:
'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.
Expose every endpoint
Section titled “Expose every endpoint”Use the * wildcard:
'exposure' => [ 'include' => ['*'], 'exclude' => [],],Expose every endpoint except some
Section titled “Expose every endpoint except some”List the endpoints to keep closed in exposure.exclude. An excluded endpoint is never exposed,
even when include names it or uses *:
'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:
'exposure' => [ 'include' => env('APP_ENV') === 'local' ? ['*'] : ['health', 'info'], 'exclude' => [],],Check the result
Section titled “Check the result”Ask the discovery endpoint which endpoints are exposed:
curl http://localhost/actuatorIf you cache routes, an exposure change takes effect only after you rebuild the cache:
php artisan route:clearphp artisan route:cache