小编use*_*551的帖子

Zuul Proxy无法路由,导致com.netflix.zuul.exception.ZuulException:转发错误

我有简单的服务:

transactions-core-service和transactions-api-service.

transactions-api-service调用transactions-core-service来返回事务列表.使用hystrix命令启用transactions-api-service.

两者都在以下服务ID的Eureka服务器中注册:

TRANSACTIONS-API-SERVICE    n/a (1) (1) UP (1) - 192.168.2.12:transactions-api-service:8083
TRANSACTIONS-CORE-SERVICE   n/a (1) (1) UP (1) - 192.168.2.12:transactions-core-service:8087
Run Code Online (Sandbox Code Playgroud)

以下是Zuul服务器:

@SpringBootApplication

@Controller

@EnableZuulProxy

public class ZuulApplication {

    public static void main(String[] args) {
        new SpringApplicationBuilder(ZuulApplication.class).web(true).run(args);
    }
}
Run Code Online (Sandbox Code Playgroud)

Zuul配置:

===============================================

info:
  component: Zuul Server

server:
  port: 8765

endpoints:
  restart:
    enabled: true
  shutdown:
    enabled: true
  health:
    sensitive: false

zuul:
  ignoredServices: "*"
  routes:
    transactions-api-service: 
    path: transactions/accounts/**
    serviceId: transactions-api-service

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

logging:
  level:
    ROOT: INFO
    org.springframework.web: DEBUG

===============================================
Run Code Online (Sandbox Code Playgroud)

当我尝试使用url(http://localhost:8765/transactions/accounts/123/transactions/786 …

netflix-zuul

11
推荐指数
3
解决办法
4万
查看次数

标签 统计

netflix-zuul ×1