Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports adding HTTP query parameter of the user request to upstream based on routing of header, cookie or query #1845

Closed
lianglli opened this issue Aug 4, 2023 · 1 comment · Fixed by #1864
Assignees

Comments

@lianglli
Copy link
Member

lianglli commented Aug 4, 2023

基于Header/Cookie/Query的路由匹配,向后端upstream转发时在请求中藏家指定的Query参数

在请求消息中增加query参数

如果存在相同的query参数,重复添加

值格式:"query name=query value[&query name=query value]*"

值校验:query以'&'分割,query名和query值以'='分割,query name和query value不允许包含'='和'&',默认最多允许增加2个query参数

无损动态生效,无需tengine reload。

@lianglli lianglli added this to the 3.0.1 milestone Aug 4, 2023
@lianglli lianglli self-assigned this Aug 4, 2023
@lianglli lianglli removed this from the 3.0.1 milestone Sep 18, 2023
@lianglli
Copy link
Member Author

lianglli commented Nov 1, 2023

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/canary: "true"
    nginx.ingress.kubernetes.io/canary-by-cookie: open2
    nginx.ingress.kubernetes.io/canary-by-cookie-value: test1||test2
    nginx.ingress.kubernetes.io/canary-response-add-header: test-result:564-29122||test-ingress7:$host
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
  creationTimestamp: "2023-10-31T06:21:12Z"
  generation: 1
  name: tengine-ingress-hello-cookie-ing
  namespace: default
  resourceVersion: "28581881"
  uid: 7879b54e-f857-4f3e-bf4f-c549dc5e44bb
spec:
  ingressClassName: opensource-ingress
  rules:
  - host: echo.w1.com
    http:
      paths:
      - backend:
          service:
            name: tengine-ingress-hello2-service
            port:
              number: 80
        path: /
        pathType: Prefix
  tls:
  - hosts:
    - echo.w1.com
    secretName: https-server-1
status:
  loadBalancer:
    ingress:
    - {}
$ curl -i -k --cookie "open2=test1" https://echo.w1.com
HTTP/2 200 
server: Tengine/3.1.0
date: Wed, 01 Nov 2023 11:41:10 GMT
content-type: text/html
content-length: 140
test-result: 564-29122
test-ingress7: echo.w1.com
last-modified: Tue, 31 Oct 2023 06:16:58 GMT
strict-transport-security: max-age=0
ups-target-key: default-tengine-ingress-hello2-service-80
x-protocol: HTTP/2.0
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000

<html><head><title>HTTP Hello World</title></head><body><h1>Hello from tengine-ingress-hello2-deployment-6dd8b6f8d4-4hf77</h1></body></html>

@lianglli lianglli closed this as completed Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant