Hi, Eureka dashboard is not serving static resources when a class annotated by @EnableEurekaServer is also annotated by @EnableConfigServer.
When only @EnableEurekaServer is present, resources are served correctly.
This seems to be very similar to #1142
The code demonstrating this problem can be found at https://github.com/marmax/eureka-config-server-static-res-issue
Comment From: dsyer
I don't think it's a great idea to embed @EnableEurekaServer in a config server for many other reasons. However, if you can find a way to fix this, please send a PR.
Comment From: marmax
Hi @dsyer, sorry for my ignorance, but can you please name some reasons why to not do so?
I just got inspired by JHipster - a project becoming a popular application prototype - and would like at least to let the guys know about this being not a good practice.
Anyway, I will try to investigate this a bit more.
Thank you in advance, M.
Comment From: 12010994
If you really want to embed config server and eureka server together, I suggest you to move your config server path (spring.cloud.config.server.prefix: /config-path) to something different that the eureka.
Otherwise, what you will observe is that when the static resource http://appname:8761/eureka/css/wro.css is fetched, it is routed by the config server as a request for a config properties file (like /application/env).
Comment From: marmax
@12010994 yes, that's a valid point about those resources being treated by config server.
When I set the prefix as you suggested, the eureka dashboard is served correctly.
Thank you!
Comment From: laurenceHR
I solve with this...
@Configuration
@EnableWebMvc
public class MvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/eureka/**")
.addResourceLocations("/eureka/","classpath:/static/eureka/");
}
}
Comment From: VVATOR
I solve with this...
@Configuration @EnableWebMvc public class MvcConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry .addResourceHandler("/eureka/**") .addResourceLocations("/eureka/","classpath:/static/eureka/"); } }
It's works! Thank you