I am using HAProxy ingress v1.9. and Kubernetes v1.26.
My access workflow:
User --> HAProxy Ingress controller --> Service --> Pod
I am trying to add custom route for service
My service yaml file is
apiVersion: v1
kind: Service
metadata:
name: test-svc
namespace: test1
annotations:
haproxy.org/route-acl: hdr(test) -m str foo or cook(test) -m str foo
kubernetes.io/ingress.class: haproxy
spec:
selector:
app: httpd
type: ClusterIP
ports:
- protocol: TCP
name: http
port: 80
targetPort: 80
- protocol: TCP
name: https
port: 443
targetPort: 443
After creating service, in haproxy.cfg, we have below entry in frontend
use_backend test1_test-svc_http if { var(txn.host) -m str
foo.com } { path -m beg / } { hdr(test) -m str foo or cook(test) -m str foo }
When calling url with header test=foo, it is working but if test=foo cookie is passed, it is redirecting to default backend.
Any guidance to solve this issue would be helpful.
Thank you!