sample-zuul-filters
sample-zuul-filters copied to clipboard
Route to multiple microservices
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
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