alibaba/tengine-ingress

Supports adding HTTP headers of the user request to upstream based on canary routing of header, cookie or query

lianglli opened this issue · 2 comments

Supports adding HTTP headers of the user request to upstream based on canary routing of header, cookie or query

nginx.ingress.kubernetes.io/canary-request-add-header

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/canary: "true"
    nginx.ingress.kubernetes.io/canary-by-header: header-test2
    nginx.ingress.kubernetes.io/canary-mod-divisor: "100"
    nginx.ingress.kubernetes.io/canary-mod-relational-operator: ==
    nginx.ingress.kubernetes.io/canary-mod-remainder: "1"
    nginx.ingress.kubernetes.io/canary-request-add-header: test-result:B0-236-564-29117||test-ssl-cipher:$ssl_cipher
    nginx.ingress.kubernetes.io/canary-request-append-header: Test-UserData:test=B0-236-564-29117||test-ssl:$ssl_protocol
    nginx.ingress.kubernetes.io/canary-response-add-header: test-result:B0-236-564-29122||test-host:$host||test-method:$request_method
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
  creationTimestamp: "2023-10-31T07:02:17Z"
  generation: 1
  name: tengine-ingress-hello-header-mod-with-actions-ing
  namespace: default
  resourceVersion: "28173436"
  uid: bfe4bc3b-d384-4718-8a0a-5f6c3e89ab68
spec:
  ingressClassName: opensource-ingress
  rules:
  - host: echo.w1.com
    http:
      paths:
      - backend:
          service:
            name: tengine-ingress-echo2-service
            port:
              number: 80
        path: /
        pathType: Prefix
  tls:
  - hosts:
    - echo.w1.com
    secretName: https-server-1
status:
  loadBalancer:
    ingress:
    - {}
$ curl -i -k -H "header-test2: 101" -H "test-ssl: default" https://echo.w1.com
HTTP/2 200 
server: Tengine/3.1.0
date: Wed, 01 Nov 2023 11:08:38 GMT
content-type: text/plain; charset=utf-8
content-length: 7
test-result: B0-236-564-29122
test-host: echo.w1.com
strict-transport-security: max-age=0
ups-target-key: default-tengine-ingress-echo2-service-80
x-protocol: HTTP/2.0
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000

echo ok

image