首页 > 解决方案 > 使用 Istio 出口网关或 ServiceEntry 将 HTTP 请求代理到外部代理

问题描述

我正在尝试使用 Istio egress gateway+ServiceEntry 或 ServiceEntry+VirtualService 将 HTTP 请求代理到外部代理,在将请求路由到外部代理之前添加一个 HTTP 标头,但我没有找到类似的示例。

可能吗 ?

我已经证明了不同的配置,但它们不起作用。

例如:

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: proxy
  namespace: lab
spec:
  hosts:
  - externalproxy
  location: MESH_EXTERNAL
  ports:
  - number: 3128
    name: http
    protocol: HTTP
  resolution: DNS

---

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: proxy-virtualservice
  namespace: lab
spec:
  hosts:
  - myservice
  http:
  - match:
    port: 3128
    rewrite:
      authority: externalproxy
    route:
    - destination:
        host: externalproxy
        port:
          number: 3128
    headers:
      request:
        add:
          myheader: test

谢谢

标签: proxyistio

解决方案


推荐阅读