Selectively using strip_path?

I’m looking at strip_path and trying to make it work for what I need. I have several services that need external exposure. One of them is a third party thing that, unlike the others, expects the url to start at root and there’s nothing really to route on. For example where the other services have urls like:

service1/myfunction/somedata
service2/somefunction/moredata

the problem service has urls like this:

/login/something
/invoice/abc

So I want to change things to make them:

service3/login/something
service3/invoice/abc

then I can strip the service3 off the path after routing and the service itself just sees what it always saw and is happy.

But the strip_path gets applied to a KongIngress which is then applied to the Ingress that handles all the services. That means it strips service3 just fine, but it also strips service1 and service2 and that gives me a larger problem.

I think I can attach a KongIngress to every other service that restores the path but that seems a silly overhead, and my initial attempt failed anyway. Is there a simpler way to do what looks like quite a simple thing?

You can separate it into two different ingress resources and apply the strip_path annotation only on the one containing the routes “service3/login/something” and “service3/invoice/abc”

1 Like