Eureka + zuul + micro services + thymeleaf - Problem loading webjars

0

I am creating a system based on the micro services architecture with the following flow.

eureka porta (8888)

zuul porta (8080)

stu_user (8081) / User / **

stu_veiculo (8082) / Vehicle / **

As I understand zuul is a gateway where when asked for example localhost:8080/Usuario/listar it will go into service stu_usuario and it will return the desired page until then, but when I started to use some .js and .css this request can not load because it tries to load the files on host 8080 but they only exist in 8081.

application.properties
    spring.application.name=zuul
zuul.add-host-header=true

server.tomcat.remote-ip-header=x-forwarded-host

# configurações do serviço usuario
zuul.routes.stu_usuario.path=/Usuario/**
zuul.routes.stu_usuario.url=http://localhost:8081
zuul.routes.stu_usuario.serviceId=stu_usuario
zuul.routes.stu_usuario.stripPrefix=false
zuul.routes.stu_usuario.sensitive-headers=Cookie,Set-Cookie,Authorization

# configurações do serviço veiculo

zuul.routes.stu_veiculo.path=/Veiculo/**
zuul.routes.stu_veiculo.url=http://localhost:8082
zuul.routes.stu_veiculo.serviceId=stu_veiculo
zuul.routes.stu_veiculo.stripPrefix=false
zuul.routes.stu_veiculo.sensitive-headers=Cookie,Set-Cookie,Authorization

eureka.client.serviceUrl.defaultZone=http://localhost:8888/eureka
eureka.client.register-with-eureka=true

server.port=8080

springbootapplication

@SpringBootApplication 
@EnableDiscoveryClient
@EnableZuulProxy
public class Configuracao {

   public static void main(String[] args) {
      SpringApplication.run(Configuracao.class, args);
   }    
   @Bean
   public PreFilter preFilter() {
      return new PreFilter();
   }
   @Bean
   public PostFilter postFilter() {
      return new PostFilter();
   }
   @Bean
   public ErrorFilter errorFilter() {
      return new ErrorFilter();
   }
   @Bean
   public RouteFilter routeFilter() {
      return new RouteFilter();
   }
}
    
asked by anonymous 17.11.2017 / 21:23

1 answer

0

Dude, I suggest using Spring Cloud Config , it's even better to change the properties of projects. As for .js and .css from an architectural point of view you'd better put them in a repository so that any changes to the files do not require you to stop running applications.

    
23.11.2018 / 21:13