How Route with different policies to same microservice endpoints

I have one micro service exposing two endpoints, say

  • GET api1
  • GET api2

exposed on url: http://mymicroservice.com

My use case is that both the endpoints need different policies (Plugins) attached to them.
How can this be achived?

So far i tried adding a service with above URL.
Then created a route with path (/mypublicapi1) but its causing both APIs being exposed on
kong:8000//mypublicapi1/api1
kong:8000//mypublicapi1/api2

Thats not what I expected. Please enlighten!!

@Vishal - You can define two different route for the same service and apply plugins specific to route.

In your case it will be two routes,
/mypublicapi/api1
/mypublicapi/api2

1 Like

Thanks John, I am able to do it!!