Cannot disable HTTP GET on / route

Hi,

I am struggling to block HTTP GETs on a certain path. I have deployed multiple ingresses, one general on path / and couple more on subpaths like /test1, /test2, etc. It works fine, but recently I was asked to block HTTP GETs exactly on /. I have created a KongIngress resource with

apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
name: my-service
route:
methods:
- POST

and I have connected it with the / Ingress with an annotation. As a result all other requests are matched with / path and they are not routed correctly to other services (so e.g. http request to /test1 is going to the service associated with Ingress /).
The / ingress is defined as below:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-service
annotations:
konghq.com/override: my-service
spec:
ingressClassName: kong
rules:
- host: api.my.host
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: my-service
port:
number: 8080

What am I doing wrong? How to block certain methods for a route? How I can set up a custom HTTP response code? E.g. 405?


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ