spring-projects / spring-projects/spring-boot

Allow Servlet Filters to be applied to Actuator endpoints when using a separate management port

Open
#16,098 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

I noticed that some of my custom filters are not applied to Actuator endpoints when a different management port is defined.

Even using :

@ManagementContextConfiguration
public class MicroServiceManagementAutoConfiguration {

  @Bean
  public FilterRegistrationBean<TestFilter> testFilter() {
    final FilterRegistrationBean<TestFilter> registrationBean  = new FilterRegistrationBean<>();

    registrationBean.setFilter(new TestFilter());
    registrationBean.addUrlPatterns("/*");

    return registrationBean;
  }
}

// registered in META-INF/spring.factories#org.springframework.boot.actuate.autoconfigure.ManagementContextConfiguration

The TestFilter is successfully applied when management.server.port == server.port but never applied when management.server.port != server.port.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with a separate management.server.port and inspect the ManagementContextConfiguration and FilterRegistrationBean registration described in the issue, including META-INF/spring.factories. Trace how the management context creates its servlet filters, then verify that TestFilter is applied to Actuator endpoints on both shared and separate ports.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.