Actuator ships with over a dozen endpoints, and the default answer to "which should we expose" is not "all of them" and not "none of them" — it's a short, deliberate list, each one behind its own access decision. Getting this wrong in either direction is common: teams either expose /actuator/env to the internet and leak configuration secrets, or lock everything down so hard that on-call has no visibility during an incident.

Start From an Empty Allowlist

The safest default is to expose nothing by web and opt in explicitly, rather than starting from * and trying to remember what to remove.

yaml
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus
  endpoint:
    health:
      show-details: when-authorized
      probes:
        enabled: true

health and info are close to mandatory — load balancers and orchestrators need health for liveness and readiness checks, and info is a cheap way to surface build metadata (git commit, version) without shipping a separate endpoint for it. metrics and prometheus (from micrometer-registry-prometheus) are what your monitoring stack scrapes and are safe to expose on an internal network, though still worth authenticating.

The Ones That Need a Second Look

A few endpoints are genuinely useful but leak information that shouldn't reach unauthenticated callers:

  • env dumps every property source, including anything that made it into Environment without being masked — database URLs, and occasionally credentials if someone didn't use a secrets manager correctly. Spring Boot sanitizes well-known sensitive key names by default, but that sanitization is a denylist, not a guarantee.
  • heapdump hands out a full heap dump on request, which can contain session tokens, decrypted request bodies sitting in memory, or anything else your application happened to be holding. Treat it like a credential.
  • threaddump and loggers are safe from an information-leak standpoint but let a caller change log levels at runtime (loggers) — genuinely useful for debugging a live incident, genuinely dangerous if anyone can flip your production logging to TRACE and watch request bodies scroll past.
  • shutdown is disabled by default for good reason and should stay that way outside of tightly controlled environments like a container orchestrator's own lifecycle hooks.

Securing What You Do Expose

Actuator endpoints should sit behind their own authorization rule, separate from your application's API security, ideally on a different port so network-level controls can do part of the job.

yaml
management:
  server:
    port: 9001
java
@Bean
SecurityFilterChain actuatorSecurityChain(HttpSecurity http) throws Exception {
    return http
        .securityMatcher(EndpointRequest.toAnyEndpoint())
        .authorizeHttpRequests(auth -> auth
            .requestMatchers(EndpointRequest.to("health", "info")).permitAll()
            .anyRequest().hasRole("OPS"))
        .httpBasic(Customizer.withDefaults())
        .build();
}

Running actuator on a separate port means it never needs to be reachable through your public load balancer at all — a security group or ingress rule can restrict it to your VPC, which is a stronger guarantee than any application-level check.

A Reasonable Default Posture

For most services: expose health (with liveness/readiness probes for Kubernetes) and info publicly or near-publicly, put metrics and prometheus behind network-level restriction to your monitoring infrastructure, and require authenticated operator access for everything else — env, loggers, threaddump, mappings, beans. Never expose heapdump or shutdown outside a locked-down operator boundary. The goal isn't zero exposure; it's making sure every exposed endpoint was a decision, not a default nobody revisited.

A worked example

Expose health (liveness/readiness split), info (git sha), prometheus on a separate management port. env and heapdump off in prod or authenticated and network-restricted. Health groups: liveness = process, readiness = DB. K8s probes hit the management port, not the public 8080.

A test: unauthenticated GET /actuator/env is 404/401.

Failure modes

Actuator on the public internet with *: *. Health that touches a slow dependency and kills the liveness probe. logfile endpoint leaking secrets. Verbose env with passwords. Micrometer high-cardinality tags via actuator.

Readiness including a downstream you cannot fix, causing a death spiral of pod restarts.

When this is the wrong tool

Actuator is not an APM. Do not expose shutdown in prod. If you already have a dedicated metrics agent, duplicate prometheus scrape may be noise. Custom JSON "status" pages for executives are not health. Heapdump endpoints are the wrong tool on 32 GB heaps without a download plan. Skip beans in prod.

A worked failure mode

env and heapdump are exposed without auth on the public port. Health includes a downstream that flaps and K8s kills the pod. The failure is actuator as a default surface. Separate management port, auth, and liveness vs readiness.

Actuator is the wrong tool to replace APM. Do not expose write endpoints. Use a small, authenticated set.

Treat the counterexample as part of the spec. Someone will apply "The Actuator Endpoints Worth Exposing (and How to Lock Them Down)" to a problem that only looks similar at the noun level—same words, different constraints. Require a one-page fit check: scale, consistency, failure domains, and who is on call. If two of those are guesses, run a spike, not a rewrite. The expensive bugs are not the ones in the happy-path tutorial; they are the ones where the tutorial's silent assumptions were load-bearing.

A worked anti-pattern: the team ships the architecture, then staffs it like a toy. "The Actuator Endpoints Worth Exposing (and How to Lock Them Down)" needs boring operations—backups, timeouts, ownership, and a budget for the tax the idea always charges (compaction, replay, dual writes, extra latency, extra types). Unstaffed taxes come due at 2am. Put the tax in the design doc's cost section. If leadership wants the benefit without the tax, the honest answer is a smaller idea, not a heroic on-call rotation.