KongPlugin auth by path

Hi there,
Is there a way to configure the key-auth KongPlugin to run only in a target path?

Like this:
##################
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: demo
annotations:
kubernetes.io/ingress.class: “kong”
plugins.konghq.com: httpbin-auth
spec:
rules:

  • http:
    paths:
    • path: /foo
      backend:
      serviceName: echo
      servicePort: 80
    • path: /bar
      backend:
      serviceName: echo
      servicePort: 80

##################
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: httpbin-auth
plugin: key-auth
route:
name: “/foo”
##################

Thanks!

Yes. You can simply split your Ingress resource into two, each with one path and then apply the plugin on only one of those ingress resources. The other one pass through without authentication in this case.


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ