KongIngress Proxy Path Not working

#1

I’m trying to create two KongIngress resources for a single service so that I can specify a different proxy path for a path that requires another form of authentication.

proxy path: /
ingress path: /api/wallet/

proxy path: /openapi
ingress path: /api/wallet/openapi

When I access the url api.foo/api/wallet/openapi I get served from path: / instead of path: /openapi indicating that the kong-wallet-open-ingress KongIngress is not being configured right but I fail to see any misconfigurations with the Ingress definitions

Kong Ingress Controller v 0.3.0
Kong v 1.1.0

Ingress Definitions

0 Likes

#2

I tried this myself and it’s not possible to have one backend service with different proxy path overrides.

When setup by Ingress controller, they will share the same backend configuration.

We had to start using a URL rewrite plugin / rule on the service level to accomodate this.

0 Likes

#3

My scenario is that I’ve got a service that I’d want to use key-auth on the service level and then on a route I want another form of authentication (anonymous in this specific case).

If I move back to only one KongIngress and one Ingress for the service, how can I apply key-auth and acl plugins for only one route?

If I put the plugins annotation on the Ingress resource it will be applied for all routes, but in this case I only want it applied to /api/wallet/openapi and not /api/wallet/

Can I maybe use one KongIngress and multiple Ingress resources to achieve this?

0 Likes

#4

What I would propose is to keep your two ingresses with the one service.

Then on one ingress rewrite the url path to /api/wallet/openapi
On the other rewrite the backend url to /api/wallet

If you use the proxy path, like said, that applies to a backend service, since you only have one backend service you can only rewrite its backend path to either “/api/wallet/openapi” or “/api/wallet” you can’t have it both ways configuring it that way.

You can look at the following plugins to apply to your kong ingress to accomplish this:

Stone payments Kong URL rewrite plugin

Kong request transformer advanced (requires Kong Enterprise)

Pearson URL rewrite plugin (this is not up to date with Kong 1.0.0 though - We are using this with custom modifications at the moment)

There might be other solutions but this is the one I am personally familiar with getting around this particular problem.

0 Likes