【问题标题】:Default configuration in zuul routingzuul路由中的默认配置
【发布时间】:2017-12-23 09:42:31
【问题描述】:

我的项目需要 zuul 中的默认配置路由,如下所示:

祖尔:

test1:  
    service-id: TEST1  
    path: /test1/** 

resource:  
  path: /error/**  
  url: http://test/Sample 

default:  
  (This needs to be rendered whenever request has url other than above mentioned).  

有人可以帮帮我吗?

【问题讨论】:

    标签: netflix-eureka netflix-zuul


    【解决方案1】:

    您可以将/** url 路由放在zuul.routes 的末尾,如下所示。

    zuul:  
      routes:
        test1:  
          service-id: TEST1  
          path: /test1/** 
        resource:  
          path: /error/**  
          url: http://test/Sample 
        default:  
          path: /**
          url: <url that you want to forward>
    

    【讨论】:

    • 我已经尝试过这个解决方案,但是路径 /** 会覆盖上面提到的所有服务 ID 和映射的 url。
    • 您使用的是哪个版本?而且,你能告诉我错误信息吗?
    • 实际上发生的情况是,每当我尝试使用 rest 客户端访问上述端点时,我都会面临 404 not found 错误,如下所示 { "timestamp": 1500438881684, "status": 404, "错误”:“未找到”,“消息”:“没有可用消息”,“路径”:“/test1/heartbeat”}。当我检查我的映射时,所有服务 ID 都被 /** 覆盖。关于发布让我回复你
    • 1.1.0.RELEASE是我们使用的版本。
    • 我什至尝试过使用 1.3.1.RELEASE。它也不起作用。
    猜你喜欢
    • 2017-02-08
    • 1970-01-01
    • 1970-01-01
    • 2016-06-05
    • 2017-11-25
    • 1970-01-01
    • 2016-09-16
    • 1970-01-01
    • 2018-09-27
    相关资源
    最近更新 更多