Search code examples
netflix-zuulspring-cloud-netflix

Handling same context path for multiple micro service in zuul configuration


We are building platform on top of Spring netflix OSS to host multiple use-cases micro service api. One of the use case have 2 API (2 code base building 2 jars) they want it to be hosted on 2 different service Id but both are having same context url eg "/loan/card/v1/individual/"

AP11-> /credit_decision/payment_plan/

API2 -> /history_decision/payment_plan/

How should I configure the rout path so that any call coming via url

/loan/card/v1/individual/credit_decision/payment_plan/ should go to API1 and

/loan/card/v1/individual/history_decision/payment_plan/ should go to API2


Solution

  • You will have to define the routing like below. I have the strip-prefix to false in case you need it you can make it true. For more info here is the link to the DOC.

    zuul:
      routes:
        API1: 
             path: /loan/card/v1/individual/credit_decision/**
             service-id: API1
             strip-prefix: false
        API2: 
             path: /loan/card/v1/individual/history_decision/**
             service-id: API2
             strip-prefix: false