Playing around with the Consul API Gateway & I have encountered a small issue I am unable to figure out.
The configuration at the bottom below works fine, but when I try to add more than one method for the rule (method: HEAD), I get an error.
I’ve tried adding as list, in multiple different “formats” without success.
The documentation states:
Specifies a list of strings that define matches based on HTTP request method.
You may specify the following values: ...
How can I add e.g. HEAD & GET to the same rule?
Error message
The HTTPRoute "whoami" is invalid:
* spec.rules[1].matches[0].method: Invalid value: "array": spec.rules[1].matches[0].method in body must be of type string: "array"
* spec.rules[1].matches[0].method: Unsupported value: []interface {}{"HEAD", "GET"}: supported values: "GET", "HEAD", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"
routes.yaml
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: whoami
namespace: default
spec:
hostnames: []
parentRefs:
- name: api-gateway
rules:
- matches:
- method: HEAD
path:
type: PathPrefix
value: /whoareyou
headers:
- name: Host
type: RegularExpression
value: "^localhost:.+$"
backendRefs:
- kind: Service
name: whoami
namespace: demos
port: 80
weight: 100
filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: /whoami
consul version: 1.15.2
helm-chart: v1.1.1 (kustomized)
Kubernetes: v1.25.9
Gateway CRDs: v0.5.4