Java Spring Boot - Change the Port of Actuator Health Endpoint to a Custom Port
Data Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.
Introduction
In Spring Boot, actuator endpoints share the management web server configuration. That means you can move /actuator/health onto a different port by setting management.server.port, but that setting moves the management HTTP endpoints together. It does not give only the health endpoint its own completely separate port while leaving the rest of actuator on the main application port.
The Main Property
By default, actuator endpoints are served on the main application port. If the app runs on 8080, then health is typically available at:
http://localhost:8080/actuator/health
To move management endpoints to another port, use:
With that configuration:
- normal application traffic stays on
8080 - actuator web endpoints move to
8081 - health becomes
http://localhost:8081/actuator/health
That is the standard Spring Boot way to separate management traffic from application traffic.
YAML Version
The same configuration in YAML:
This is often easier to maintain in projects that already keep most Spring Boot configuration in application.yml.
Important Limitation
The title question sounds like only the health endpoint should move. Spring Boot does not provide a separate port setting for one individual actuator web endpoint.
The management port applies to the management web server as a whole. So if you configure:
then web-exposed actuator endpoints use that management port together.
If the real requirement is:
- health on one port
- other actuator endpoints on another port
then you usually need a different architecture, such as:
- a reverse proxy that routes selectively
- separate deployment boundaries
- a custom endpoint exposure strategy in front of the app
Spring Boot’s built-in setting is for management-port separation, not per-endpoint port separation.
Minimal Example
With the earlier configuration and Spring Boot Actuator on the classpath:
- '
http://localhost:8080/serves the normal application route' - '
http://localhost:8081/actuator/healthserves health'
That is usually enough for load balancers, container probes, and internal monitoring.
Why Teams Use a Separate Management Port
A different management port is useful when:
- internal health checks should bypass public app routing
- firewalls or security groups differ for app traffic and operations traffic
- Kubernetes or load balancer probes should hit a dedicated listener
- operators want monitoring traffic isolated from business traffic
This is mainly an operational separation feature. It is helpful, but it is not complete security by itself. If the management port is publicly reachable, you still need access control and sane endpoint exposure.
Related Settings That Matter
A custom management port often goes with a narrow exposure list:
If you are in a containerized environment, probe support may also matter:
In some deployments you may also want to bind the management listener to a specific network address with management.server.address.
Common Pitfalls
The most common mistake is assuming Spring Boot can move only /actuator/health to a separate port while leaving other actuator endpoints on the original one. The built-in port setting applies to the management web server as a whole.
Another issue is changing management.server.port but forgetting to align infrastructure with it. Container port declarations, service definitions, and health probes must match the new port.
People also often assume a different port automatically makes management traffic secure. It only separates traffic; security rules still need to be enforced deliberately.
Finally, watch profile-specific configuration. An environment variable or production profile can override the port you think you set locally.
Summary
- Use
management.server.portto move actuator web endpoints to a dedicated management port. - This setting moves management web endpoints together, not only the health endpoint.
- Keep
server.portfor normal application traffic and expose only the actuator endpoints you need. - Update probes, container ports, and service configuration to match the new management port.
- Treat the separate management port as traffic separation, not as complete security by itself.
Related reading
- Java Spring Boot How to map my app root “/” to index.html?
- Java Spring Boot How to map my app root “/” to index.html?
- Java Spring Boot Test How to exclude java configuration class from test context
- Java Spring REST API Handling Many Optional `Parameters`
- Java Spring Security - User.withDefaultPasswordEncoder is deprecated?
- Java Stanford NLP Part of Speech labels?
- Java Static vs inner class
- Java Stream API - Best way to transform a list map or forEach?

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.