【问题标题】:Make Zuul the unique entry point of my application让 Zuul 成为我的应用程序的唯一入口点
【发布时间】:2019-02-15 03:27:36
【问题描述】:

我的应用程序在端口 8081 上包含一个名为“service”的服务,其中包含一些 API,例如

  • localhost:8081/api/services
  • localhost:8081/api/services/id
  • ...

使用在 8761 端口上运行的 Zuul,我现在可以像这样访问这些 API

  • localhost:8761/service/api/services
  • localhost:8761/service/api/services/id

但是,仍然可以使用以前的 API(直接到服务)。怎么可能阻止它们,以使 Zuul 成为唯一的入口点?

【问题讨论】:

  • 您不应阻止它们,而应在内部将它们重新路由到新服务。为什么要打破现有服务的所有用法?这与良好做法完全相反。
  • 你检查过这个吗? stackoverflow.com/questions/45045466/…
  • 你可以使用 docker,将所有服务放在同一个网络中,并且不要暴露 service 容器上的端口

标签: java spring-boot spring-security microservices netflix-zuul


【解决方案1】:

如果您运行绑定到 localhost 的服务,则只能从该框访问它。你不需要做更多的事情。

【讨论】:

    猜你喜欢
    • 2019-11-06
    • 1970-01-01
    • 2015-07-26
    • 1970-01-01
    • 2014-05-19
    • 1970-01-01
    • 1970-01-01
    • 2017-07-06
    • 1970-01-01
    相关资源
    最近更新 更多