I would like to setup zuul and the underlying microservices in a way that all services will be under the '/gateway' context.
For example:
Microservice 1 has : http://localhost:8081/api/hello
Microservice 2 has : http://localhost:8082/api/bye
I would want to be able to access the microservices via zuul as follows:
Microservice 1 : http://localhost:8080/gateway/microservice1/api/hello
Microservice 2: http://localhost:8080/gateway/microservice2/api/bye
I have tried to set this up, although it seems the requests are not getting routed correctly.
The reason I would like the front end to route all client side REST calls to server that begin with '/gateway' is that it provides simpler maintenance to the front end.
My application.yml:
zuul:
prefix: /gateway
routes:
microservice1:
path: /microservice1/**
serviceId: microservice1
strip-prefix: true
microservice2:
path: /microservice2/**
serviceId: microservice2
strip-prefix: true
Thank you
Try this config and let me know if this works out for you. I think you will have to define a global
strip-prefix:true
like below. Actually it should also work without strip prefix since by default it will strip both the prefix.