【发布时间】:2022-01-03 00:17:43
【问题描述】:
我正在使用 Istio 1.10.0 和 minikube。 Kubernetes服务器版本为1.19.8。
如何在http请求中添加多个header?是否可以放置像request.headers["Host"] 这样的动态值?
X-Forwarded-Host $host;
X-Forwarded-Port 9090;
X-Forwarded-Proto http;
以下示例可以正常添加响应标头。
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
annotations:
helm.sh/hook: pre-install, pre-upgrade
creationTimestamp: "2021-11-22T13:01:36Z"
generation: 8
name: direct-vs
namespace: cvrm
resourceVersion: "72069"
selfLink: /apis/networking.istio.io/v1beta1/namespaces/cvrm/virtualservices/cvrm-direct-vs
uid: d398a13e-fd81-4ada-8e36-617287cae1bc
spec:
gateways:
- gateway.istio-system.svc.cluster.local
hosts:
- '*'
http:
- match:
- uri:
prefix: /console
route:
- destination:
host: console-bs.cvrm.svc.cluster.local
port:
number: 8087
headers:
response:
add:
Custom-Header: test
【问题讨论】:
标签: kubernetes istio