Spring Cloud Zuul/Eureka dynamic route

后端 未结 1 787
情书的邮戳
情书的邮戳 2020-12-28 20:32

I am using spring cloud eureka and spring cloud zuul proxy and i was wondering if there is any way to add dymanic zuul routes when a new service is register in eureka server

相关标签:
1条回答
  • 2020-12-28 20:53

    If your Zuul server is also EurekaClient (use @EnableDiscoveryClient annotation) it will discover all the services and automatically will create routes.

    Ex. Zuul server is zuul.mydomain.com Eureka has 2 services registered with it : orders and accounts

    Then Zuul will automatically have two routes Zuul.mydomain.com/orders and Zuul.mydomain.com/accounts

    And this will forward to particular service. It will also automatically load balance calls for you if services run on multiple machines.

    0 讨论(0)
提交回复
热议问题