0
I am creating a system based on micro service architecture with the following flow.
Eureka door(8888)
Zuul door(8080)
stu_usuario (8081) /Usuario/**
stu_vehicle (8082) /Vehicle/**
From what I understand Zuul is a gateway where when asked for example localhost:8080/Usuario/listar
he get angry in the service stu_usuario
and will return me the desired page so far so good, but when I started using some .js
and .css
this request cannot load because Lá 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();
}
}