通过zuul向eureka客户端的请求将重定向到Tomcat主页

时间:2020-06-07 19:19:28

标签: spring-boot netflix-eureka netflix-zuul

我正在尝试将zuul用作我的春季启动微服务的eureka代理。在本地,一切正常,但是当我在tomcat上部署时,对代理的所有请求都将重定向到Tomcat主页。
示例:
在区域设置上:http://localhost:9090/serice-1/getAll可以正常工作。
在云上:
http://xx.yy.zz.ww:8080/gateway/service-1/getAll给出404
http://xx.yy.zz.ww:8080/gateway/service-1/提供了Tomcat主页
http://xx.yy.zz.ww:8080/gateway/service-1/myservice/getAll运行正常

这是我的zuul服务application.properties内容:

spring.application.name=zuul-server
spring.jmx.default-domain=zuul-server
eureka.client.serviceUrl.defaultZone=http://localhost:8080/eureka/eureka
zuul.ignored-services=*
zuul.host.socket-timeout-millis=60000
zuul.host.connect-timeout-millis=10000
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=60000
ribbon.eureka.enabled=true
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
eureka.client.preferSameZoneEureka=true
zuul.routes.myservice.path=/service-1/**
zuul.routes.myservice.serviceId=myservice

这是我的GatewayApplication:

@SpringBootApplication(scanBasePackages ="com.gateway")
@EnableZuulProxy
@EnableDiscoveryClient
@EnableFeignClients("com.gateway")
public class GatewayApplication extends SpringBootServletInitializer {
        @Override
        protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
                return application.sources(GatewayApplication.class);
        }

        public static void main(String[] args) {
                SpringApplication.run(GatewayApplication.class, args);
        }

}

也许我在滥用某些属性,但是我尝试了很多,但没有一个起作用。

0 个答案:

没有答案