sample-zuul-filters icon indicating copy to clipboard operation
sample-zuul-filters copied to clipboard

Route to multiple microservices

Open patpatpat123 opened this issue 6 years ago • 1 comments
trafficstars

Hello Spencer, hello community,

I am having a use case I have to complete, and would like your help on the gateway.

Requirement: Let's say I am having a micro service called myService, which exposed /getData and /saveData.

Now, I am deploying this myService to multiple locations, like: myServiceAWS, myServicePCF, myServiceAzure, etc...

Is it possible with Zuul, or Spring Cloud Gateway, to route to ALL of them based on the route? If I do something like

zuul.ignoredServices=* zuul.routes.myService.path=//getData/ zuul.routes.myService.url=http://myServiceAWS:8080,http://myServicePCF:8081,http://myServiceAzure:8082

That results in an error.

If I do something like zuul.routes.myService.path=//getData/ zuul.routes.myService.url=http://myServiceAWS:8080/

zuul.routes.myService.path=//getData/ zuul.routes.myService.url=http://myServicePCF:8081/

Always only the first one is taken into account. Could you please advice if it is possible to route to ALL with Zuul (Or Spring Cloud Gateway)? Or maybe, a way to do it with filters please?

Thank you very much

patpatpat123 avatar Mar 22 '19 14:03 patpatpat123

Maybe you can try this:

zuul:
  ignoredServices: '*'
  routes:
    aws:
      path: /getData
      serviceId: xxxService

xxxService:
  ribbon:
    listOfServers: http://myServiceAWS:8080,http://myServicePCF:8081,http://myServiceAzure:8082

dengliming avatar Apr 13 '20 04:04 dengliming