Posted in

How to expose Actuator endpoints over HTTP?

If you run a microservices architecture, you already know that keeping track of your application’s inner workings—performance metrics, health status, and configuration details—isn’t just a nice-to-have; it’s how you prevent outages and deliver reliable services. That’s where Spring Boot Actuator comes in: it’s the tool that gives you those critical insights. But a common question I hear from developers and ops teams is, “How do I expose Actuator endpoints over HTTP?” As someone who’s spent years building and supporting Actuator integrations for businesses large and small, I’ve worked through every edge case, from basic setup to securing sensitive data, and I’m here to share what I’ve learned. Actuator

First, let’s cut through the noise. Exposing Actuator endpoints over HTTP sounds straightforward, but it’s easy to make mistakes that leave your system vulnerable or incomplete. I’ve seen teams either expose too many endpoints (opening the door to breaches) or too few (blind to what’s going wrong) because they skipped a few key steps. Whether you’re new to Actuator or looking to refine your current setup, this guide will walk through every part of the process, including common pitfalls and how to avoid them.

Starting with the Basics: What Are Actuator Endpoints?

Before we dive into exposing them, let’s make sure we’re on the same page. Actuator endpoints are RESTful resources that let you interact with and gather data about your Spring Boot application. Some, like /actuator/health, are built to be public—they show if your app is running without revealing sensitive details. Others, like /actuator/env or /actuator/beans, give access to configuration and internal beans, which are definitely not something you want to broadcast to the entire internet.

When you first add Actuator to a Spring Boot project, not all endpoints are enabled by default. By default, only the health endpoint is exposed over JMX (Java Management Extensions) and HTTP. That means if you just add the Actuator dependency and try to hit /actuator/health in your browser, it won’t work—at least not until you adjust the configuration. That’s where most developers start: they add the dependency, test, and get a 404, and that’s where confusion sets in.

Step 1: Add the Necessary Dependencies

The first step is making sure Actuator is included in your project. If you’re using Maven, you’ll add this to your pom.xml:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

If you’re using Gradle, it looks like this:

implementation 'org.springframework.boot:spring-boot-starter-actuator'

This pulls in the core Actuator libraries, but to work with HTTP, you’ll also need the Spring Web starter (which you probably already have if your app is a web service). Spring Web handles the HTTP layer that exposes Actuator endpoints to external requests. Without Spring Web, Actuator can’t serve endpoints over HTTP—so if you’re building a non-web app, you’ll need to add spring-boot-starter-web even if you don’t have a traditional web UI.

I’ve had more than a few clients come to me saying their endpoints won’t load, and nine times out of ten, it’s because they forgot to include the Web starter. It’s a small detail, but it’s the foundation of exposing endpoints over HTTP, so don’t skip it.

Step 2: Configure Endpoint Exposure Over HTTP

Once the dependencies are in place, the next step is to tell Spring Boot which endpoints you want to expose over HTTP. This is where the application.properties or application.yml file comes in. The key properties here are management.endpoints.web.exposure.include and management.endpoints.web.exposure.exclude.

Let’s break that down. The include property lets you list the endpoints you want to make public, and the exclude property lets you remove ones you don’t need. You can use specific endpoint IDs, or shorthand like * to include all endpoints—though I almost never recommend using * in production. Too many endpoints expose sensitive data, and the last thing you want is a bad actor pulling your environment variables or listing all your application’s beans.

For example, if you want to expose only the health and info endpoints over HTTP, your application.properties would look like this:

management.endpoints.web.exposure.include=health,info

If you’re using YAML, it’s:

management:
  endpoints:
    web:
      exposure:
        include: "health,info"

What if you need more endpoints, like metrics to track application performance or a shutdown endpoint to gracefully stop the app? You can add those, but be intentional. For example, to expose health, info, and metrics:

management.endpoints.web.exposure.include=health,info,metrics

Now, a common question: what if you want to include most endpoints but exclude a few sensitive ones? That’s where exclude comes in. Let’s say you want everything except the env and configprops endpoints:

management.endpoints.web.exposure.include=*
management.endpoints.web.exposure.exclude=env,configprops

This is a middle ground that works well for many teams. It gives you visibility into most of your app’s state without giving away your configuration details, which often contain database credentials or API keys.

Another point to note: endpoints have different levels of sensitivity. The shutdown endpoint, for example, lets you stop the application. If you expose that over HTTP without securing it, anyone can trigger a shutdown. That’s a disaster waiting to happen, so make sure you never expose sensitive endpoints in public environments unless you have strict security controls in place.

Step 3: Customize the Endpoint Path

By default, Actuator endpoints live under /actuator, so the health endpoint is at /actuator/health. But some teams prefer to change this path to avoid conflicts with other routes, or to make it less obvious that you’re using Actuator. That’s easy to adjust with the management.endpoints.web.base-path property.

For example, if you want endpoints to live under /admin instead of /actuator, add this to your configuration:

management.endpoints.web.base-path=/admin

Now the health endpoint is at /admin/health, and the info endpoint is at /admin/info. This might seem like a small change, but it’s a simple way to add a layer of obscurity, which can help deter casual attackers who are scanning for common Actuator endpoints.

I’ve worked with teams that use custom paths as part of their security strategy, and while it’s not a replacement for proper authentication, it’s a quick win that adds a little extra protection. Just make sure your monitoring tools (like Prometheus or Grafana) are updated to use the new path, or you’ll end up with missing metrics.

Step 4: Secure Your Exposed Endpoints

Here’s where many teams go wrong: they expose endpoints over HTTP but don’t secure them. Actuator endpoints can give attackers a ton of information about your app—from dependencies to configuration. If you leave them open, you’re essentially handing over a map of your system.

Spring Security is the standard way to secure HTTP endpoints in Spring Boot, and it works seamlessly with Actuator. If you have Spring Security added as a dependency, you’ll need to configure it to require authentication for Actuator endpoints, and allow public access only to the endpoints that should be public.

Let’s look at a basic Spring Security configuration for Actuator. First, add the Spring Security dependency to your pom.xml (or build.gradle):

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

Then, create a security configuration class to define access rules. Here’s a simple one that allows public access to health and info, and requires authentication for all other Actuator endpoints:

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.SecurityFilterChain;

@Configuration
public class SecurityConfig {

    @Bean
    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
        http
            .authorizeHttpRequests(auth -> auth
                .requestMatchers("/actuator/health", "/actuator/info").permitAll()
                .requestMatchers("/actuator/**").authenticated()
            )
            .httpBasic(); // or formLogin, depending on your needs
        return http.build();
    }
}

This configuration means that anyone can check if your app is healthy or get basic info, but to access metrics, beans, or other endpoints, you need to log in with valid credentials.

Another security best practice: use HTTPS for all Actuator traffic. If you’re exposing endpoints over HTTP, make sure you’re redirecting to HTTPS. You can configure that in Spring Boot with security.require-ssl=true in your properties file, which will ensure that all requests to your app use HTTPS.

I can’t stress this enough—securing Actuator endpoints is non-negotiable. I’ve had clients who didn’t do this, and ended up with their Actuator endpoints scraped by bots, leading to exposed sensitive data. Don’t cut corners here.

Step 5: Test Your Exposed Endpoints

Once you’ve configured everything, it’s time to test. You can use tools like curl, Postman, or even a browser to check if your endpoints are accessible. Let’s say you exposed health and info at /actuator/health and /actuator/info.

First, test the public endpoints:

curl https://your-app-domain.com/actuator/health

You should get a response like:

{"status":"UP"}

That means the endpoint is accessible and working. If you try to access an endpoint that’s supposed to be secured, like /actuator/env, you should get a 401 Unauthorized response, prompting you to log in.

If you get a 404 when you try to access an endpoint, double-check your exposure.include configuration to make sure the endpoint name is correct. Some endpoints have different IDs—for example, the metrics endpoint is metrics, but the prometheus endpoint (which is popular for scraping) is prometheus. If you’re using Prometheus, make sure to include prometheus in your include list so it’s exposed.

Another test: if you changed the base path to /admin, your health endpoint should be at /admin/health. If that doesn’t work, check the base-path property in your configuration—typos are easy to make here, and a wrong path will break access.

Common Pitfalls to Avoid

After working with dozens of teams on Actuator integrations, I’ve seen the same mistakes pop up again and again. Let’s cover the most common ones so you can avoid them.

First, exposing too many endpoints. It’s tempting to use include=* to get all the data, but in production, that’s a huge security risk. Sensitive endpoints like shutdown, env, and heapdump should never be exposed publicly. If you need to use them in your internal environment, make sure they’re behind a VPN or a strict authentication layer.

Second, forgetting to update monitoring tools. If you change the base path or expose new endpoints, make sure your monitoring system (like Prometheus, Datadog, or New Relic) is configured to use the new paths. I’ve had teams spend hours debugging missing metrics only to realize they forgot to update the Actuator path in their monitoring setup.

Third, not handling environment differences. Your local development environment is different from staging and production. In local, you might expose all endpoints for testing, but in production, you should limit exposure and enforce security. You can use Spring profiles to separate configurations—for example, a local profile that includes all endpoints, and a prod profile that only includes health and info. That way, you don’t have to remember to adjust the configuration when deploying to different environments.

Fourth, ignoring endpoint permissions. If you have a multi-tenant app, you might want to restrict Actuator endpoints per user or team. For example, your dev team might need access to metrics, but your customer support team only needs access to health. Spring Security lets you add role-based access control to Actuator endpoints, which is a must for larger teams.

When to Work with a Specialist Like Me

Exposing Actuator endpoints over HTTP is doable with the steps above, but if you’re running a complex environment—like a distributed microservices setup with multiple services, or you need advanced security compliance—you might run into issues. That’s where my team comes in. We’ve helped hundreds of businesses integrate Actuator with their infrastructure, troubleshoot exposure issues, and secure endpoints to meet compliance standards like GDPR or HIPAA.

I’ve seen teams try to handle this on their own and end up with gaps that lead to outages or data breaches. For example, one client a few years ago tried to expose all endpoints over HTTP without security, and their /actuator/env endpoint leaked database credentials, leading to a breach that cost them tens of thousands of dollars in downtime and remediation. Since we worked with them to adjust their configuration and implement strict security controls, they’ve had zero issues with Actuator.

Whether you need help setting up initial exposure, customizing endpoints for your environment, or hardening security for production, we’re here to guide you. We don’t just provide a tool—we provide expertise that comes from years of working with Actuator, so you can avoid the mistakes that cost teams time and money.

Final Thought

Exposing Actuator endpoints over HTTP doesn’t have to be complicated. By adding the right dependencies, configuring exposure carefully, customizing paths when needed, and securing endpoints with Spring Security, you can get the visibility you need into your application without putting your system at risk. The key is to be intentional: only expose the endpoints you need, limit access to sensitive ones, and test your setup regularly.

If you’re looking to streamline your Actuator setup, secure your endpoints, or troubleshoot any issues you’re running into, we’re ready to help. We work with teams of all sizes, from startups to enterprise businesses, to make Actuator work for their specific needs. Reach out to us to discuss your requirements and see how we can support your Actuator integration.

References

Globe Valve Spring Boot Actuator Documentation
Spring Security Reference Guide
Prometheus and Actuator Integration Guide


Wuxi PYNOS Flow-tech Co., Ltd.
As one of the leading actuator manufacturers and suppliers in China, we offer a wide range of products with superior quality. We warmly welcome you to buy high quality actuator made in China here from our factory. We also accept customized orders.
Address: Sales Center: 7th Floor, No.19 Qingyuan RD, Wuxi City, Jiangsu Prov., China
E-mail: Info@pynosvalve.com
WebSite: https://www.pynosvalves.com/