spring-cloud/spring-cloud-netflix

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

suojinxing opened this issue · 1 comments

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

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