http://tencent.com 和 https://tencent.com 需要访问到同一个 Web 服务。https://tengxun.com 更换为 https://tencent.com,两个域名访问到同一个 Web 服务。ingress.cloud.tencent.com/rewrite-support: "true"
HTTPS:443 监听器,并在其下创建转发规则。通过调用本接口,系统会自动创建出一个 HTTP:80 监听器(如果之前不存在),并在其下创建转发规则,与 HTTPS:443 监听器下的域名等各种配置对应。


ingress.cloud.tencent.com/auto-rewrite: "true"
ingress.cloud.tencent.com/rewrite-support: "true" # 表示允许重定向
# 原注解 格式:{"host": "<domain>","path": "<path>","backend": {"serviceName": "<service name>","servicePort": "<service port>"}}# 新注解格式:{"host": "<domain>","path": "<path>","backend": {"serviceName": "<service name>","servicePort": "<service port>"},"rewrite": {"port": "<rewrite-port>","host": "<rewrite-domain>","path": "<rewrite-path>"}}
121.4.25.44/path2 进行访问,在发布新版本之后,期望通过 121.4.25.44/v2/path2 进行访问。可以进行如下修改:ingress.cloud.tencent.com/rewrite-support: "true" # 允许重定向
# 将 /v1/path1 替换为 /path1 80端口;把 /v2/path2 替换为 /path2 80端口。注意:host 可以省略kubernetes.io/ingress.http-rules: '[{"path": "/path1","backend": {"serviceName": "path1","servicePort": "80"}},{"path": "/path2","backend": {"serviceName": "path2","servicePort": "80"}},{"path": "/v1/path1","rewrite": {"port": 80,"path": "/path1"}},{"path": "/v2/path2","rewrite": {"port": 80,"path": "/path2"}}]'
apiVersion: extensions/v1beta1kind: Ingressmetadata:annotations:description: testingress.cloud.tencent.com/rewrite-support: "true"kubernetes.io/ingress.class: qcloudkubernetes.io/ingress.http-rules: '[{"path":"/path1","backend":{"serviceName":"path1","servicePort":"80"}},{"path":"/path2","backend":{"serviceName":"path2","servicePort":"80"}},{"path":"/v1/path1","rewrite":{"port":80,"path":"/path1"}},{"path":"/v2/path2","rewrite":{"port":80,"path":"/path2"}}]'kubernetes.io/ingress.https-rules: "null"kubernetes.io/ingress.rule-mix: "true"name: testnamespace: defaultspec:rules:- http:paths:- backend:serviceName: path1servicePort: 80path: /path1pathType: ImplementationSpecific- http:paths:- backend:serviceName: path2servicePort: 80path: /path2pathType: ImplementationSpecificstatus:loadBalancer:ingress:- ip: 121.4.25.44
文档反馈