【问题标题】:Zuul reverse proxy first request failsZuul 反向代理第一次请求失败
【发布时间】:2019-01-21 17:52:45
【问题描述】:

设置:

我正在使用 Zuul 反向代理向两个不同的后端服务发送请求。我不需要此应用程序的任何负载平衡。我只配置了一个过滤器,它不参与这个过程并且确认没有被调用。每个服务的 Zuul listOfServers 在运行时使用来自服务器的以下代码动态填充:

clientFactory.getClientConfig(SERVICE_ID).set(CommonClientConfigKey.ListOfServers, "https://" + host + ":" + port);`

相关application.yaml设置如下:

zuul:
  ignored-services: '*'
  add-proxy-headers: false
  sensitive-headers:

  # Use more descriptive name for the Zuul servlet bypass
  servlet-path: '/large-file-uploads'

  ribbon:
    eager-load:
      enabled: true

  routes:
    serviceone:
      path: /service_one/**
      serviceId: 'service_one'
    servicetwo:
      path: /service_two/**
      serviceId: 'service_two'

ribbon:
  eureka:
    enabled: false

问题:

listOfServers 设置后应该(通过上面的代码),对服务的第一个请求返回状态 500 并且服务器打印 Zuul 转发错误(可以找到 here)。任何后续调用都会按预期进行。此外,它似乎只有在后端服务重新启动后才会发生,尽管这不是服务的问题(通过 Postman 测试确认)。

任何帮助将不胜感激。谢谢!

【问题讨论】:

    标签: spring-cloud netflix-zuul netflix-ribbon


    【解决方案1】:

    原来是读取超时问题,请看 ryanjbaxter 的回答:https://github.com/spring-cloud/spring-cloud-netflix/issues/3021

    【讨论】:

      猜你喜欢
      • 2017-02-27
      • 1970-01-01
      • 2017-02-08
      • 2018-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-24
      相关资源
      最近更新 更多