spring-cloud / spring-cloud-netflix

Integration with Netflix OSS components
http://cloud.spring.io/spring-cloud-netflix/
Apache License 2.0
4.87k stars 2.44k forks source link

The API '/serverinfo/statusoverrides' from class ServerInfoResource don't work. #4247

Closed suojinxing closed 5 months ago

suojinxing commented 8 months ago

Describe the bug Class ServerInfoResource provides a HTTP API looks like '/serverinfo/statusoverrides'.

The contents of the ServerInfoResource are as follows

@Path("/serverinfo")
public class ServerInfoResource {
    @GET
    @Path("statusoverrides")
    public Response getOverrides() throws Exception {
         // omit...
    }
}

But when I use PostMan or other API-Tools send HTTP request. always reponse 404

The url is http://localhost:8761/eureka/serverinfo/statusoverrides

image

Sample

I review the source code. I think the EurekaServerAutoConfiguration inject a Bean by the method that name is 'jerseyFilterRegistration'.

@Bean
public FilterRegistrationBean<?> jerseyFilterRegistration(javax.ws.rs.core.Application eurekaJerseyApp) {
    FilterRegistrationBean<Filter> bean = new FilterRegistrationBean<Filter>();
    bean.setFilter(new ServletContainer(eurekaJerseyApp));
    bean.setOrder(Ordered.LOWEST_PRECEDENCE);
    bean.setUrlPatterns(Collections.singletonList(EurekaConstants.DEFAULT_PREFIX + "/*"));
    return bean;
}

It blocks all HTTP requests beginning with '/eureka'.

But jersey does not have a rule matching ‘/eureka/serverinfo’. jersey only has a rule match '/serverinfo'.

So I can't request the API that ServerInfoResource provides anyway

bug

OlgaMaciaszek commented 5 months ago

Hello @suojinxing, that class is part of the https://github.com/Netflix/eureka project and not Spring Cloud Netflix.